Re: [PATCH v1 1/1] platform/x86: ideapad-laptop: Make the scope_guard() clear of its scope
From: Josh Poimboeuf
Date: Wed Sep 04 2024 - 00:52:13 EST
On Thu, Aug 29, 2024 at 07:50:32PM +0300, Andy Shevchenko wrote:
> First of all, it's a bit counterintuitive to have something like
>
> int err;
> ...
> scoped_guard(...)
> err = foo(...);
> if (err)
> return err;
>
> Second, with a particular kernel configuration and compiler version in
> one of such cases the objtool is not happy:
>
> ideapad-laptop.o: warning: objtool: .text.fan_mode_show: unexpected end of section
>
> I'm not an expert on all this, but the theory is that compiler and
> linker in this case can't understand that 'result' variable will be
> always initialized as long as no error has been returned. Assigning
> 'result' to a dummy value helps with this. Note, that fixing the
> scoped_guard() scope (as per above) does not make issue gone.
I'm not sure I buy that, we should look closer to understand what the
issue is. Can you share the config and/or toolchain version(s) need to
trigger the warning?
--
Josh