Skip to content

Commit d4debbc

Browse files
aakoskintmlind
authored andcommitted
mmc: omap: fix broken slot switch lookup
The lookup is done before host->dev is initialized. It will always just fail silently, and the MMC behaviour is totally unpredictable as the switch is left in an undefined state. Fix that. Fixes: e519f0b ("ARM/mmc: Convert old mmci-omap to GPIO descriptors") Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Message-ID: <20240223181439.1099750-4-aaro.koskinen@iki.fi> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
1 parent 480d44d commit d4debbc

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

drivers/mmc/host/omap.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,13 +1384,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
13841384
if (IS_ERR(host->virt_base))
13851385
return PTR_ERR(host->virt_base);
13861386

1387-
host->slot_switch = gpiod_get_optional(host->dev, "switch",
1388-
GPIOD_OUT_LOW);
1389-
if (IS_ERR(host->slot_switch))
1390-
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
1391-
"error looking up slot switch GPIO\n");
1392-
1393-
13941387
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
13951388
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
13961389

@@ -1409,6 +1402,12 @@ static int mmc_omap_probe(struct platform_device *pdev)
14091402
host->dev = &pdev->dev;
14101403
platform_set_drvdata(pdev, host);
14111404

1405+
host->slot_switch = gpiod_get_optional(host->dev, "switch",
1406+
GPIOD_OUT_LOW);
1407+
if (IS_ERR(host->slot_switch))
1408+
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
1409+
"error looking up slot switch GPIO\n");
1410+
14121411
host->id = pdev->id;
14131412
host->irq = irq;
14141413
host->phys_base = res->start;

0 commit comments

Comments
 (0)