Re: [PATCH 09/24] mmc: mtk-sd: check for valid optional memory resource

From
Yingjoe Chen <hidden>
Date
2019-03-24 03:34:49
Also in
linux-arm-kernel, linux-clk, linux-gpio, linux-i2c, linux-mediatek, linux-mmc, linux-serial, linux-spi, linux-watchdog, lkml
Reply to
Fabien Parent, 2019-03-23
On Sat, 2019-03-23 at 22:15 +0100, Fabien Parent wrote:
quoted hunk ↗ jump to hunk
'top_base' memory region is optional. Check that the resource is valid
before using it. This avoid getting a "invalid resource" error message
printed by the kernel.

Signed-off-by: Fabien Parent <redacted>
---
 drivers/mmc/host/mtk-sd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 833ef0590af8..573aa127d00b 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2123,9 +2123,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	host->top_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(host->top_base))
-		host->top_base = NULL;
+	if (ret) {
This should be res?
quoted hunk ↗ jump to hunk
+		host->top_base = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(host->top_base))
+			host->top_base = NULL;
+	}
 
 	ret = mmc_regulator_get_supply(mmc);
 	if (ret)
Thread (70 messages) 70 messages, 12 authors, last reply 2019-04-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help