From: Dan Carpenter Date: Tue, 14 Jul 2020 14:14:10 +0000 (+0300) Subject: mmc: sdhci: Fix a potential uninitialized variable X-Git-Tag: v5.15~3201^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=907be2a62e4522c3dc3c298a213ccc741bd22732;p=platform%2Fkernel%2Flinux-starfive.git mmc: sdhci: Fix a potential uninitialized variable Smatch complains that "ret" can be used without being initialized. drivers/mmc/host/sdhci.c 4383 if (!IS_ERR(mmc->supply.vqmmc)) { 4384 if (enable_vqmmc) { ^^^^^^^^^^^^ 4385 ret = regulator_enable(mmc->supply.vqmmc); ^^^^^ 4386 host->sdhci_core_to_disable_vqmmc = !ret; 4387 } "ret" is only initialized when "enable_vqmmc" is true. Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20200714141410.GB314989@mwanda Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index d3b62fc..3d272063 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -4104,7 +4104,7 @@ int sdhci_setup_host(struct sdhci_host *host) unsigned int ocr_avail; unsigned int override_timeout_clk; u32 max_clk; - int ret; + int ret = 0; bool enable_vqmmc = false; WARN_ON(host == NULL);