input: touchscreen: mxs-lradc: Do a NULL check on iores
Subsystems (3)
Fabio Estevam
reviewerPATCH v2 1/1 input: touchscreen: mxs-lradc: Do a NULL check on iores
From: Fabio Estevam <[email protected]>
platform_get_resource() may fail, so we should better do a NULL check and return error on failure.
Signed-off-by Fabio Estevam <[email protected]>
---
Changes since v1:
- Instead of using devm_ioremap_resource, do a NULL check on iores
drivers/input/touchscreen/mxs-lradc-ts.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/touchscreen/mxs-lradc-ts.c +2 -0
@@ -630,6 +630,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)spin_lock_init (&ts->lock); iores =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!iores) +return -EINVAL ; ts->base =devm_ioremap (dev, iores->start,resource_size (iores));if (IS_ERR (ts->base))return PTR_ERR (ts->base);
Signature · 1 line
2.7.4
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
platform_get_resource()may fail, so we should better do a NULL check and return error on failure.Signed-off-by Fabio Estevam <[email protected]>
Applied, thank you.
Quoted 23 lines
---
Changes since v1:
- Instead of usingdevm_ioremap_resource, do a NULL check on ioresdrivers/input/touchscreen/mxs-lradc-ts.c | 2 ++ 1 file changed, 2 insertions(+)drivers/input/touchscreen/mxs-lradc-ts.c +2
-0@@ -630,6 +630,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)spin_lock_init (&ts->lock); iores =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!iores) +return -EINVAL ; ts->base =devm_ioremap (dev, iores->start,resource_size (iores));if (IS_ERR (ts->base))return PTR_ERR (ts->base);Signature · 1 line
2.7.4
Signature · 1 line
Dmitry