[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190308.232057.1297154950610356905.davem@davemloft.net>
Date: Fri, 08 Mar 2019 23:20:57 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: natechancellor@...il.com
Cc: peppe.cavallaro@...com, alexandre.torgue@...com,
joabreu@...opsys.com, mcoquelin.stm32@...il.com,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com, ndesaulniers@...gle.com
Subject: Re: [PATCH] net: stmmac: Avoid one more sometimes uninitialized
Clang warning
From: Nathan Chancellor <natechancellor@...il.com>
Date: Thu, 7 Mar 2019 21:02:39 -0700
> When building with -Wsometimes-uninitialized, Clang warns:
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable
> 'ns' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable
> 'ns' is used uninitialized whenever '&&' condition is false
> [-Werror,-Wsometimes-uninitialized]
>
> Clang is concerned with the use of stmmac_do_void_callback (which
> stmmac_get_systime wraps), as it may fail to initialize these values if
> the if condition was ever false (meaning the callback doesn't exist).
> It's not wrong because the callback is what initializes ns. While it's
> unlikely that the callback is going to disappear at some point and make
> that condition false, we can easily avoid this warning by zero
> initializing the variable.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/384
> Fixes: df103170854e ("net: stmmac: Avoid sometimes uninitialized Clang warnings")
> Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Applied, thanks Nathan.
Powered by blists - more mailing lists