From: Fabio Estevam Date: Mon, 14 Aug 2017 17:26:27 +0000 (-0700) Subject: Input: mxs-lradc - do a NULL check on iores X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e48060ce2c7f73e424272bd6f5d9f996f1853064;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c index 58c016cd6809..71bf493e8b58 100644 --- a/drivers/input/touchscreen/mxs-lradc-ts.c +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -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);