summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2025-08-21 15:32:49 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2025-08-22 12:07:39 +0200
commit6fb942b85a1ab9728a4551d4161ec6fd6fab94f3 (patch)
tree8c75476277c31b8f8e9741148fdbe2e949ad81a4 /drivers/mmc
parent1f69220b0998b609000c6ea1783772fdaecaec56 (diff)
mmc: rtsx_usb_sdmmc: Fix uninitialized variable issue
If rtsx_usb_get_card_status() fails then "val" isn't initialized. Move the use of "val" until after the error checking. Fixes: d2e6fb2c31a0 ("misc: rtsx: usb card reader: add OCP support") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/aKcR8QD81TjVqIhl@stanley.mountain Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/rtsx_usb_sdmmc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index e1ed39c657c3..70bd21084b97 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -785,13 +785,13 @@ static int sdmmc_get_cd(struct mmc_host *mmc)
mutex_unlock(&ucr->dev_mutex);
- /* get OCP status */
- host->ocp_stat = (val >> 4) & 0x03;
-
/* Treat failed detection as non-exist */
if (err)
goto no_card;
+ /* get OCP status */
+ host->ocp_stat = (val >> 4) & 0x03;
+
if (val & SD_CD) {
host->card_exist = true;
return 1;