From patchwork Thu Jun 22 02:51:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9803357 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 7A3A060234 for ; Thu, 22 Jun 2017 02:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6869F2861B for ; Thu, 22 Jun 2017 02:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56EE8285D3; Thu, 22 Jun 2017 02:51:38 +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_ADSP_CUSTOM_MED, 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 D18FC28599 for ; Thu, 22 Jun 2017 02:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752369AbdFVCvb (ORCPT ); Wed, 21 Jun 2017 22:51:31 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:35699 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752288AbdFVCva (ORCPT ); Wed, 21 Jun 2017 22:51:30 -0400 Received: by mail-qt0-f196.google.com with SMTP id x58so506357qtc.2 for ; Wed, 21 Jun 2017 19:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/62aVXVOkvSytbW1clq8jupJ51BqZJ/X9TvkbT9tR8A=; b=fqx12dW6Ufquxv1jaqlXjn/tKuUIzOQ7IKLzplYKjN9mjE71wRv4q8fU1Eq+SXS2AZ DUYtm0zrqSgs8mmzIPLzJTzFTwrp/xOg0OBcp4kVnJe+Tk8XTW3/TmpBe0Ww/7uaijcm TKL7fuYARbsT720NahkvCoZDcUG6P9o934gNWu6UaEm+aDR63aVkUSy8D9oSdcGhsHzP OQxxcTxix+yDpElMCkikvusTHYEv9FPDv5j7AARJwuVRkge7J0bMZEELIxj0gQWz0myu N2JwARDzIS4cgpPHnuufAqwHq4FFng6/A/gsB8wzh7z60UrCq06ktScp2wklo11fW5Df f5qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/62aVXVOkvSytbW1clq8jupJ51BqZJ/X9TvkbT9tR8A=; b=AldKwxBj6i3BlWF6ibwhoSpXG+Bt2j6A4wvNDOfSgKy6M98kQrBYfxTMbjtOEm/IKr EUtEGaclEA1zkhDnhaeouFAVcU1OnOje8GgT26VENa4ZeUhEKi4FqmGjjmh/IWV+ollC knmI41BKa0jayhHN/QBPvJF3o0w4C68fn3boAIQ1ZbG0s/hkDyuNCiuXKw/iXdnoVN71 iziDQLPAQhzZnOMfKFDk6beSnLkJQT/4B3LTVBxda+k47Sua58fyfTSYbKR0KhIglX6W PC4FfVFJPqJpXD8FIS+A7iBKHWRSlSEJnm+6c+DOCiXDiRlDxe2q5twPk9jw0laYqhVn g5Fg== X-Gm-Message-State: AKS2vOzBvl2wS4tkN6L9a4wxxWQiqufyqYPS1aW4KhsetcUW/Mldn+RV GSQALychnopBIQ== X-Received: by 10.200.1.8 with SMTP id e8mr373655qtg.172.1498099889663; Wed, 21 Jun 2017 19:51:29 -0700 (PDT) Received: from localhost.localdomain ([189.61.213.245]) by smtp.gmail.com with ESMTPSA id 55sm178947qtz.9.2017.06.21.19.51.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 19:51:29 -0700 (PDT) From: Fabio Estevam To: dmitry.torokhov@gmail.com Cc: marex@denx.de, ksenija.stanojevic@gmail.com, linux-input@vger.kernel.org, Fabio Estevam Subject: [PATCH v2] input: touchscreen: mxs-lradc: Do a NULL check on iores Date: Wed, 21 Jun 2017 23:51:12 -0300 Message-Id: <1498099872-16959-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 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 From: Fabio Estevam platform_get_resource() may fail, so we should better do a NULL check and return error on failure. Signed-off-by: Fabio Estevam --- Changes since v1: - Instead of using devm_ioremap_resource, do a NULL check on iores drivers/input/touchscreen/mxs-lradc-ts.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c index 58c016c..71bf493 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);