* [PATCH v2] mmc: mtk-sd: check for valid optional memory resource
@ 2019-04-03 19:30 Fabien Parent
2019-04-11 10:43 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Fabien Parent @ 2019-04-03 19:30 UTC (permalink / raw)
To: ulf.hansson, matthias.bgg, yingjoe.chen
Cc: chaotian.jing, ryder.lee, jjian.zhou, linux-mmc,
linux-arm-kernel, linux-mediatek, linux-kernel, Fabien Parent
'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 <fparent@baylibre.com>
---
V2:
Fix invalid condition: check against 'res' variable instead of 'ret'.
---
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..61bf8704491c 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 (res) {
+ 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)
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mmc: mtk-sd: check for valid optional memory resource
2019-04-03 19:30 [PATCH v2] mmc: mtk-sd: check for valid optional memory resource Fabien Parent
@ 2019-04-11 10:43 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2019-04-11 10:43 UTC (permalink / raw)
To: Fabien Parent
Cc: Matthias Brugger, Yingjoe Chen, Chaotian Jing, Ryder Lee,
Jjian Zhou, linux-mmc, Linux ARM, linux-mediatek,
Linux Kernel Mailing List
On Wed, 3 Apr 2019 at 21:31, Fabien Parent <fparent@baylibre.com> wrote:
>
> '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 <fparent@baylibre.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
>
> V2:
> Fix invalid condition: check against 'res' variable instead of 'ret'.
>
> ---
> 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..61bf8704491c 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 (res) {
> + 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)
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-11 10:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 19:30 [PATCH v2] mmc: mtk-sd: check for valid optional memory resource Fabien Parent
2019-04-11 10:43 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).