Re: [PATCH][next] ASoC: rt-sdw-common: Fix bit-wise or'ing of values into uninitialized variable ret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 08, 2024 at 06:04:08PM +0100, Mark Brown wrote:
> On Tue, Oct 08, 2024 at 05:47:07PM +0100, Colin Ian King wrote:
> > There are a handful of bit-wise or'ing of values into the uninitialized
> > variable ret resulting in garbage results. Fix this by ininitializing
> > ret to zero.
> 
> I'm very disappinted in the compiler for not noticing this :(

We disabled GCC's uninitialized variable check years ago before we enabled
-Werror.  Clang does catch this.

  CC      sound/soc/codecs/rt-sdw-common.o
sound/soc/codecs/rt-sdw-common.c:119:3: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
                ret |= SND_JACK_BTN_2;
                ^~~
sound/soc/codecs/rt-sdw-common.c:111:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0

regards,
dan carpenter





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux