From patchwork Tue Aug 8 13:00:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 9888129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F74A601EB for ; Tue, 8 Aug 2017 13:02:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41F472889A for ; Tue, 8 Aug 2017 13:02:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3577A288DE; Tue, 8 Aug 2017 13:02:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C75EA288EE for ; Tue, 8 Aug 2017 13:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbdHHNBc (ORCPT ); Tue, 8 Aug 2017 09:01:32 -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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=AklIMUnz8ST2QmQ9+f VEQi2291BRyrhWi521haBHx6A=; b=Ajrj5Bm6MP65i5U4gi0EwZ/FAkfqIzxtEQ 6SMnyl3AYW290VfhfHINucow+tDj3/sCYXtcx7/6avVQr/4yF4hYcB4Lcr4O88g5 zlRAykXSjoe+E0inPYYxWArXnFqDdM1jqlItPMXZoxsAJJIvM6uUtAwN0gGEj7T6 5idV5/018= Received: from localhost.localdomain (unknown [106.120.213.62]) by smtp8 (Coremail) with SMTP id DMCowAB3Onn_tYlZnHZNIw--.9846S3; Tue, 08 Aug 2017 21:00:50 +0800 (CST) 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-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);