From patchwork Mon Jul 2 12:43:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10501279 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 7077360325 for ; Mon, 2 Jul 2018 12:43:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60A3C1FF81 for ; Mon, 2 Jul 2018 12:43:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54BC11FFE6; Mon, 2 Jul 2018 12:43:49 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E72F21FF81 for ; Mon, 2 Jul 2018 12:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ekCr+v02I9ZH1JrfZV/nDiv9TSXs6jA0HhoRmETvdm4=; b=UArcOwJR4nbD8o to8MVFzT8XP/q5ZvZQqMEapc5IHl5rblGqMrgC7Pi/XcminyhEAJZeYui7B5/81PgcN0tKVIreMrS NOEIdrgVEGfRfhbZhE2/w8H2c0Qks+3Ni3sT5X6daRacDPKT8/ykYryRWdzaRubKcenJ5KQUl1ElZ oJbfhHiFAtKDuhDDS5VpRJaF/xBup/o6oc4st42QgdQYb0Vd7DoPbHcs0Jd6e60X+IvPFKFpBpMsj igyfx6cdP0XC08Td4yV3hSBWnbj14swsXMxvuJCw0y4UTi2DxuSTgskyak2yxdDHzOARKz/+3aAfw 4ZbM2K9Wif531weIKTlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZyBE-0002Mo-M1; Mon, 02 Jul 2018 12:43:44 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZyBB-0002Ig-U8 for linux-arm-kernel@lists.infradead.org; Mon, 02 Jul 2018 12:43:43 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fZyB0-0005fN-5I; Mon, 02 Jul 2018 12:43:30 +0000 From: Colin King To: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Manivannan Sadhasivam , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Subject: [PATCH] pinctrl: actions: fix unsigned less than zero comparison Date: Mon, 2 Jul 2018 13:43:29 +0100 Message-Id: <20180702124329.7087-1-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180702_054342_111011_EE0DFC64 X-CRM114-Status: GOOD ( 10.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King The check to see if platform_get_irq failed is performed on the unsigned value of pctrl->irq[i] and the check is never true because an unsigned cannot be less than zero. Fix this by assinging the signed int ret to the return of platform_get_irq and checking ret instead. Detected by CoverityScan, CID#1470247 ("Unsigned comparison against 0") Fixes: 6c5d0736e9c0 ("pinctrl: actions: Add interrupt support for OWL S900 SoC") Signed-off-by: Colin Ian King --- drivers/pinctrl/actions/pinctrl-owl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c index 4fa9cc377b3b..133ce9e0000a 100644 --- a/drivers/pinctrl/actions/pinctrl-owl.c +++ b/drivers/pinctrl/actions/pinctrl-owl.c @@ -1026,11 +1026,10 @@ int owl_pinctrl_probe(struct platform_device *pdev, } for (i = 0; i < pctrl->num_irq ; i++) { - pctrl->irq[i] = platform_get_irq(pdev, i); - if (pctrl->irq[i] < 0) { - ret = pctrl->irq[i]; + ret = platform_get_irq(pdev, i); + pctrl->irq[i] = ret; + if (ret < 0) goto err_exit; - } } ret = owl_gpio_init(pctrl);