]> www.infradead.org Git - users/hch/misc.git/commitdiff
mmc: sdhci-cadence: Fix -Wuninitialized in sdhci_cdns_tune_blkgap()
authorNathan Chancellor <nathan@kernel.org>
Tue, 19 Aug 2025 17:28:49 +0000 (10:28 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 20 Aug 2025 16:40:18 +0000 (18:40 +0200)
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/mmc/host/sdhci-cadence.c:297:9: error: variable 'hrs37_mode' is uninitialized when used here [-Werror,-Wuninitialized]
    297 |         writel(hrs37_mode, hrs37_reg);
        |                ^~~~~~~~~~
  drivers/mmc/host/sdhci-cadence.c:291:16: note: initialize the variable 'hrs37_mode' to silence this warning
    291 |         u32 hrs37_mode;
        |                       ^
        |                        = 0

A previous revision assigned SDHCI_CDNS_HRS37_MODE_MMC_HS200 to
hrs37_mode in a switch statement but the final revision moved to a
simple if statement. Pass that as the value to writel() and
remove hrs37_mode, clearing up the warning.

Fixes: 60613a8b9b81 ("mmc: sdhci-cadence: implement multi-block read gap tuning")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: BenoƮt Monin <benoit.monin@bootlin.com>
Link: https://lore.kernel.org/r/20250819-mmc-sdhci-cadence-fix-uninit-hrs37_mode-v1-1-94aa2d0c438a@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-cadence.c

index a2a4a5b0ab964883cef8c5d7f6e0c961fe76bc13..eaa88897a256c0e18514d8180fab4f9b2957f40f 100644 (file)
@@ -288,13 +288,12 @@ static int sdhci_cdns_tune_blkgap(struct mmc_host *mmc)
        void __iomem *hrs38_reg = priv->hrs_addr + SDHCI_CDNS_HRS38;
        int ret;
        u32 gap;
-       u32 hrs37_mode;
 
        /* Currently only needed in HS200 mode */
        if (host->timing != MMC_TIMING_MMC_HS200)
                return 0;
 
-       writel(hrs37_mode, hrs37_reg);
+       writel(SDHCI_CDNS_HRS37_MODE_MMC_HS200, hrs37_reg);
 
        for (gap = 0; gap <= SDHCI_CDNS_HRS38_BLKGAP_MAX; gap++) {
                writel(gap, hrs38_reg);