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>
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;