Commit e48060ce authored by Fabio Estevam's avatar Fabio Estevam Committed by Dmitry Torokhov

Input: mxs-lradc - do a NULL check on iores

platform_get_resource() may fail, so we should better do a NULL check
and return error on failure.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 94aef061
...@@ -630,6 +630,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev) ...@@ -630,6 +630,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
spin_lock_init(&ts->lock); spin_lock_init(&ts->lock);
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iores)
return -EINVAL;
ts->base = devm_ioremap(dev, iores->start, resource_size(iores)); ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
if (IS_ERR(ts->base)) if (IS_ERR(ts->base))
return PTR_ERR(ts->base); return PTR_ERR(ts->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment