From: Nathan Chancellor <natechancel...@gmail.com>
Date: Thu,  7 Mar 2019 11:00:28 -0700

> When building with -Wsometimes-uninitialized, Clang warns:
> 
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:495:3: warning: variable 
> 'ns' is used uninitialized whenever 'if' condition is false 
> [-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:495:3: warning: variable 
> 'ns' is used uninitialized whenever '&&' condition is false 
> [-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:532:3: warning: variable 
> 'ns' is used uninitialized whenever 'if' condition is false 
> [-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:532:3: warning: variable 
> 'ns' is used uninitialized whenever '&&' condition is false 
> [-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:741:3: warning: variable 
> 'sec_inc' is used uninitialized whenever 'if' condition is false 
> [-Wsometimes-uninitialized]
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:741:3: warning: variable 
> 'sec_inc' is used uninitialized whenever '&&' condition is false 
> [-Wsometimes-uninitialized]
> 
> Clang is concerned with the use of stmmac_do_void_callback (which
> stmmac_get_timestamp and stmmac_config_sub_second_increment wrap),
> as it may fail to initialize these values if the if condition was ever
> false (meaning the callbacks don't exist). It's not wrong because the
> callbacks (get_timestamp and config_sub_second_increment respectively)
> are the ones that initialize the variables. While it's unlikely that the
> callbacks are ever going to disappear and make that condition false, we
> can easily avoid this warning by zero initialize the variables.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/384
> Suggested-by: Nick Desaulniers <ndesaulni...@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulni...@google.com>
> Signed-off-by: Nathan Chancellor <natechancel...@gmail.com>

Applied.

Reply via email to