Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbdHHNBd (ORCPT ); Tue, 8 Aug 2017 09:01:33 -0400 Received: from m12-12.163.com ([220.181.12.12]:52250 "EHLO m12-12.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbdHHNBb (ORCPT ); Tue, 8 Aug 2017 09:01:31 -0400 From: Pan Bian To: Dmitry Torokhov , Lee Jones , Ksenija Stanojevic , Marek Vasut , Dan Carpenter Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: input: touchscreen: mxs-lradc: use correct error check Date: Tue, 8 Aug 2017 21:00:37 +0800 Message-Id: <1502197237-19251-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DMCowAB3Onn_tYlZnHZNIw--.9846S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7JF18CFykur13CF45Kr1Dtrb_yoWDAFbE93 yrZF93JryDAw4Ykr1Dtw13Zryv9F1rWrZ7Aw4rt3yayr1xJwsrtwsxZ3WkArW8uF47tryq kr1a9F4a9a1xCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnSeHDUUUUU== X-Originating-IP: [106.120.213.62] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiVAIuclUMBQDItgAAso Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 961 Lines: 27 Function devm_ioremap() will return a NULL pointer on failure. However, in function mxs_lradc_ts_probe(), its return value is checked with IS_ERR(), which cannot detect the exceptional case. Signed-off-by: Pan Bian --- drivers/input/touchscreen/mxs-lradc-ts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c index 58c016c..9bcc98c6 100644 --- a/drivers/input/touchscreen/mxs-lradc-ts.c +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -631,8 +631,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev) iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); ts->base = devm_ioremap(dev, iores->start, resource_size(iores)); - if (IS_ERR(ts->base)) - return PTR_ERR(ts->base); + if (!ts->base) + return -ENOMEM; ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires", &ts_wires); -- 1.9.1