[PATCH] mmc: sdhci-brcmstb: Initialize base_clk to NULL in sdhci_brcmstb_probe()

Florian Fainelli f.fainelli at gmail.com
Wed Jun 8 10:13:01 PDT 2022



On 6/8/2022 5:27 PM, Nathan Chancellor wrote:
> Clang warns a few times along the lines of:
> 
>    drivers/mmc/host/sdhci-brcmstb.c:302:6: warning: variable 'base_clk' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>            if (res)
>                ^~~
>    drivers/mmc/host/sdhci-brcmstb.c:376:24: note: uninitialized use occurs here
>            clk_disable_unprepare(base_clk);
>                                  ^~~~~~~~
> 
> base_clk is used in the error path before it is initialized. Initialize
> it to NULL, as clk_disable_unprepare() calls clk_disable() and
> clk_unprepare(), which both handle NULL pointers gracefully.
> 
> Fixes: 2cecaac1b21c ("mmc: sdhci-brcmstb: Add ability to increase max clock rate for 72116b0")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1650
> Reported-by: kernel test robot <lkp at intel.com>
> Signed-off-by: Nathan Chancellor <nathan at kernel.org>

Acked-by: Florian Fainelli <f.fainelli at gmail.com>
-- 
Florian



More information about the linux-arm-kernel mailing list