Commit c3c0ed75 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Ulf Hansson

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

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/1650Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20220608152757.82529-1-nathan@kernel.orgSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f78bc9f2
......@@ -256,7 +256,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment