diff options
author | Nathan Chancellor <nathan@kernel.org> | 2022-06-08 08:27:57 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:32:07 +0200 |
commit | 0d709c0ccceb67e54d1d7ada10a4ae84fbd7a8bb (patch) | |
tree | 0440b320936f550054c83ef0c75eac250d52263a | |
parent | 35254cb9d115d4c8a72a20e67580f52aef4cbd14 (diff) |
mmc: sdhci-brcmstb: Initialize base_clk to NULL in sdhci_brcmstb_probe()
commit c3c0ed75ffbff5c70667030b5139bbb75b0a30f5 upstream.
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.
Link: https://github.com/ClangBuiltLinux/linux/issues/1650
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20220608152757.82529-1-nathan@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/mmc/host/sdhci-brcmstb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index 600d185abac0..05b06fcc90bf 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -257,7 +257,7 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) struct sdhci_host *host; struct resource *iomem; struct clk *clk; - struct clk *base_clk; + struct clk *base_clk = NULL; int res; match = of_match_node(sdhci_brcm_of_match, pdev->dev.of_node); |