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: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Fabio Estevam 2017-08-14 10:26:27 -07:00 committed by Dmitry Torokhov
parent 94aef061c7
commit e48060ce2c

View File

@ -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);