From patchwork Mon Jul 2 12:15:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10501247 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 9B5786028F for ; Mon, 2 Jul 2018 12:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88059286B4 for ; Mon, 2 Jul 2018 12:15:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C315287AB; Mon, 2 Jul 2018 12:15:56 +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 052C0286B4 for ; Mon, 2 Jul 2018 12:15:56 +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=gByTLhszE2Y28i TQ8cR6K81+98CN3qVag7TebWhBhWVDJoAc9Mj/w0x1xY3NpSHJpo36jya1H3T9Id2RBYvjSAqaY2w /OALvztz1zT6GHq1f6oTvlOD9Yx7GOkm1ruXxCKlr6ti5tPiH3noPbH42Kk78D6YyQAbacE/3y+gQ DPMpJ85X08Oz1lEhd0bVSapZ22K14t0bTEhsfBvzHg3BS92wbu9WeLoNcFjeDAlEcbYV2X9BUs7io lcD7nqQyn2ETtoedidHNtzotK/7sO3lCaPVP4tmE9T5QCxt5x05DpzeZwQMseTQ6yGjnbqB7F63Hm r814lM5HnC/QJn1sRDCg==; 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 1fZxkE-0004ma-U2; Mon, 02 Jul 2018 12:15:50 +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 1fZxjl-0003mZ-RL for linux-arm-kernel@lists.infradead.org; Mon, 02 Jul 2018 12:15:48 +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 1fZxjV-0002o4-8j; Mon, 02 Jul 2018 12:15:05 +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][next] pinctrl: actions: fix unsigned less than zero comparison Date: Mon, 2 Jul 2018 13:15:04 +0100 Message-Id: <20180702121504.6731-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_051522_650058_F978EC22 X-CRM114-Status: GOOD ( 10.55 ) 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);