From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7B728EA4C for ; Thu, 10 Apr 2025 18:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744310622; cv=none; b=Kh5dR8ixAr2REvIZ9zOEWzVpQtkMJgnKSMZsYH7RHBfFq28K6s9FULcFnJqk+Fl2GZjbetRQ3dls/h+imWmuh2/pjBSU0O4Z0dHDQ7jyPBeoD4+N2B07jnHWRNBZ4A+tMRz4IFY3Upk8UafwcKAv2d3dS1w8dH3mkBZCQJnu8II= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744310622; c=relaxed/simple; bh=wLmrLuGso/E6VTZWxwck/fJMS6jpZqNyrtnxiPHATSI=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VGOXBE7pFVfZ/sbyXfKd1jGIjhRJn0SJz2rippB1H8qTjTvDxWvGI1OOU4CqP/0JiI37oYmAzL3xWy/LKUDqcZghz1STATZZaU1N+u1pFEfqZIlG0MxVuRO8q+TUyRPIXOMx0XVZ62isVPbnYMSkautoI1jlzYabbTNF98AQ5Is= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-232.elisa-laajakaista.fi [88.113.26.232]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id acba84e4-163b-11f0-9b8d-005056bdf889; Thu, 10 Apr 2025 21:43:20 +0300 (EEST) From: Andy Shevchenko Date: Thu, 10 Apr 2025 21:43:19 +0300 To: Dmitry Torokhov Cc: Andy Shevchenko , Mark Brown , Mathieu Dubois-Briand , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kamel Bouhara , Linus Walleij , Bartosz Golaszewski , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Michael Walle , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-pwm@vger.kernel.org, =?iso-8859-1?Q?Gr=E9gory?= Clement , Thomas Petazzoni Subject: Re: [PATCH v6 05/12] regmap: irq: Remove unreachable goto Message-ID: References: <20250409-mdb-max7360-support-v6-0-7a2535876e39@bootlin.com> <20250409-mdb-max7360-support-v6-5-7a2535876e39@bootlin.com> <1b280408-888e-48e1-8e6b-de4e7a913e74@sirena.org.uk> <7126e672-a829-489e-a0c0-8d6d64a8b2f4@sirena.org.uk> <28982424-d425-47c3-b910-58c787e13510@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Wed, Apr 09, 2025 at 10:16:40AM -0700, Dmitry Torokhov kirjoitti: > On Wed, Apr 09, 2025 at 07:45:42PM +0300, Andy Shevchenko wrote: > > On Wed, Apr 09, 2025 at 05:32:55PM +0100, Mark Brown wrote: > > > On Wed, Apr 09, 2025 at 07:00:24PM +0300, Andy Shevchenko wrote: > > > > On Wed, Apr 09, 2025 at 04:46:04PM +0100, Mark Brown wrote: > > > > > > > > unreachable() just annotates things, AFAICT it doesn't actually > > > > > guarantee to do anything in particular if the annotation turns out to be > > > > > incorrect. > > > > > > > I;m not sure I follow. unreachable is a wrapper on top of > > > > __builtin_unreachable() which is intrinsic of the compiler. > > > > > > > https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable > > > > > > That just says that the program is undefined if we get to the > > > __builtin_undefined() and documents some behaviour around warnings. One > > > example of undefined behaviour would be doing nothing. > > > > Theoretically yes, practically return after a BUG() makes no sense. Note, > > that compiler effectively removes 'goto exit;' here (that's also mentioned > > in the documentation independently on the control flow behaviour), so > > I don't know what you expect from it. > > So unreachable() sometimes lears to weird behavior from compiler, for > example as mentioned here where we ended up removing it to prevent > miscompilations: > > https://lore.kernel.org/all/20241010222451.GA3571761@thelio-3990X/ How does it affect the BUG()? >From your link: "I tested using BUG() in lieu of unreachable() like the second change I mentioned above, which resolves the issue cleanly, ..." -- With Best Regards, Andy Shevchenko