From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796121864; b=cY+ifhxQItqTEDIIce5wMxH3SKBeZMFa727fDRFtLrC+3C9SmxhNqbjvvTH6AFU4iIfr YeuJJmW3v60oLWWPNs2AJ0HJGcqdiYyMqOXGfriL76ISP7I1ssyVLs2TbfKQn4qh0LO2L xu/iMVZmUOU7L3/pDnZV9w0NsCzNAMpsVf4cVcWF0JTpKaPeJ8p3A/fY6FYthiWDts3HC ZTejoyiybQ6tF1PLQGI8TNH8X5HyGGxnvKqRt+8JI7TKcktebcbLh31s8NbsRCMkUOkPs UutLNzvshxspxzL0EyGqWxPyaGVVsxlsIY7KBsoHJbWHDMOWoGMYxm9fCCG96m8DVSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121864; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=CNk826n2ROi/U1mhN2rDWC3mcteCHVPxeG2oEKEi4Y0=; b=r9eH2Yy40Y9GvW7YYDGrOeRUTal6eZ/E5YyAaYTQuM0J15tz1qqvk+EQkmh90c233qzt WWfAfdCYkVz/0MdLjmsxUV2mMYucQiRV9rw2zS5ZuBMZeUMecX8QTXA03XzwsKr72fPLE GDhkKPjZkohn4PAmAiVo60aV5bEe/T8Y54HRe9cPPiRzjbLuK61Hd7c/jforOWJQjcZ4d u8z516L4k6uNks6j6+hK4xNO5VyRUXHQpCKWtLauF/Ju6beRuDqPtmU2wSL8cjO/2+aSu UIsFdt9hJdPpd1X2AThJekpFe1BI3PevpHc2/195fgfEPPcpyTBQROKVKjzbFIBkrVg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mRNXJ7vS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B6AF606A320; Tue, 1 Dec 2026 10:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mRNXJ7vS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 350F51F000C1; Tue, 1 Dec 2026 10:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796121863; bh=CNk826n2ROi/U1mhN2rDWC3mcteCHVPxeG2oEKEi4Y0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=mRNXJ7vSM63B/l9m6dqhOHas7WB4csp7m5YeNJ/EZr1Bf9sl/LOjgqy278apV5eAE dQFY9KiMce5W46vPTf03f4AzjVi9xw4HT14lMYIzJ/f8d0ui/oSsxNCkWkayTxJZbK wxNQscdTBG+Gy7A5Z7ZPtKk83vudC+KAEVcftqoI= Date: Tue, 1 Dec 2026 11:44:20 +0100 From: Greg Kroah-Hartman To: Amit Sunil Dhamne Cc: Josef Bacik , Alan Stern , linux-kernel@vger.kernel.org, Badhri Jagan Sridharan , Heikki Krogerus , stable , linux-usb@vger.kernel.org Subject: Re: [PATCH 12/19] usb: typec: tcpci: don't act on unread alerts Message-ID: <2026120115-crusader-enactment-5a37@gregkh> References: <20261027-llm-usb-v1-0-b9751ddb9c7c@linuxfoundation.org> <20261027-llm-usb-v1-12-b9751ddb9c7c@linuxfoundation.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Nov 02, 2026 at 02:23:57PM -0800, Amit Sunil Dhamne wrote: > Hi, > > On 10/27/26 7:57 AM, Greg Kroah-Hartman wrote: > > From: Josef Bacik > > > > tcpci_irq() ignores the result of nearly all its register reads. > > > > If the first read of TCPC_ALERT fails, "status" is an unwritten variable, > > and its bits decide which events are reported to the port manager: among > > them a hard reset, which drops VBUS. If the read at the end of the function > > fails, "status" keeps the alerts which have just been handled: they are > > handled again, for as long as the read fails. > > > > In the receive branch the byte count, the header and the payload are not > > checked: a count made of stack content trips the WARN_ON(), and a message > > made of stack content is handed to tcpm_pd_receive(). A failed read of the > > frame type returns a negative errno as irqreturn_t, with RX_STATUS still > > set. > > > > The handler must not simply return in these cases. Nine in-tree boards > > connect ALERT# to an edge triggered interrupt: as long as an alert is > > pending the line stays low, and there is no further edge. That is what the > > read at the end is for. > > > > So read the alert register through a helper which tries three times and > > reports "no alert" if that fails: after a failed first read the function > > falls through to the read at the end. Drop a message which cannot be read, > > but clear RX_STATUS, to release the line. Don't take an unread power status > > mask for a reset of the TCPC. Return IRQ_HANDLED if any round has found an > > alert, not only the first one. > > > > nit: This commit is quite verbose. It would be better if it were more > succinct and to the point. For example, the last paragraph narrates the code > rather than stating the intent. Yeah, LLMs love to be chatty, I'll go clean this up to be more concise, thanks for the review. greg k-h