From patchwork Sun Nov 19 04:34:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065035 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 44BF76023A for ; Sun, 19 Nov 2017 04:34:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39494295CA for ; Sun, 19 Nov 2017 04:34:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D8AB295CD; Sun, 19 Nov 2017 04:34:37 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 BDBA6295CA for ; Sun, 19 Nov 2017 04:34:36 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=OQ6FfHUHeuEApZx8sGR/9+vGAAe5b5qcr76KajXe+c0=; b=FVq GcJ1p2/CN+ijVu2tSB8YMdR+Fe0Mp6K/FD8X86T6jBihDaxUg2woloQqDtDvXxmLmBCKhalB9jw4x 63CBE2KKEFfrPea6vNvgJ12d4cQ3tbkVwalRpijbSN7woT8x4cWbRTJ0a5JIg+qt+qkhgsemUwlQv 8ApCLj8QLw5bvB9PutSh9yigwryVJp0yNBwuSMzFerrnFY6ZnCktWKiOkXpIwb8oaPGRqOXNgfNbp 9E1Wjhjm7BXkMEH3MyQEA8/ddmSiphcPNPb87zbvOYbu9chCOFWK3jWbb5w1t0ZRYg+sOT4/nU5wa miZ0nzXv1W18XggVkmc74on8uaZCC9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eGHJS-0000W9-Um; Sun, 19 Nov 2017 04:34:34 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGHJP-0000Ui-Kv for linux-arm-kernel@lists.infradead.org; Sun, 19 Nov 2017 04:34:33 +0000 Received: by mail-pf0-x241.google.com with SMTP id a84so4867410pfl.0 for ; Sat, 18 Nov 2017 20:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=AOOd+JK1Yno4LWvzc8Von3i/Hq0sqV1eIuA4/FoSDDU=; b=lwIBDc/DfaWKJKCU2yZk5dCE/bikcIHaP9mZ0dA9EoQLOk8sUQqsS2RNj0KnocJjHg KjV14FzM58Lk4jtqqcc8sZmhGWFpCFUyRIXxS1Ox0EaoXpJGGRhvC93Kl6kpdcEw5pbE RrlL9LSl8GQQE1uALx1WphNlobrtWL/XfqmLCYs0Znp98w6o+66V+fZqW2Jz85kvB7zE ejS4GkxDoIpfTiZ0T6tiG0tgsAN2x6BsXAlytw8WH4YjuKlx+7omNOF0pzY4Sc3ru7a6 megUzM9IGSYkYpSGnQIq5SAD5qlKoWQsejJGF+CrACyiGgkKGsEjMOpwEj4r3psyxijK gzTQ== 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=AOOd+JK1Yno4LWvzc8Von3i/Hq0sqV1eIuA4/FoSDDU=; b=mU9fNE8dyduyHgWJh9o1in2YrKDv0NwLYyvvZ5+AgPqeWNH1b5/Ak8vCWJ/d5HtwnG q8bBHuUFX1UIaMvbIUujwAYfs3Lv+shvVZsjl3pakFfKVmLTKFYBr1A+XW5D7AUFHjre D2ksX+vm5nwD3P33F3sZDuqC1X0rJganO8m1JEl1AC5GyiLyqqi+wGCF76LChxBtH2+D 8lIiUONbaSM+wH30kXQWrM89eVPyLJ3WLqSYtHhrEcYPjtZ5gPfsZP7sSXeEBP97g4Ww Cwu5uSjDQiuswFS1/dykcbD1tTHfuLZiqZdiq0rm9VY+4zrswSJNqDO/A9EM2wxlSixp /iSw== X-Gm-Message-State: AJaThX7sZ6mrg2A0Xt1Gw6BB/z9F3tpNqVyHFhMwYPPJgUy9dJ8Z22XN ygJP1Tsyu7V5YAXqlF51Vcs= X-Google-Smtp-Source: AGs4zMbhvSkmJSQDSLNLD05YyUntbafioKiVgof5QCDovFAIP3YLQSfBH9tZJU5POquZOJtygNYpHw== X-Received: by 10.159.255.70 with SMTP id u6mr9915314pls.372.1511066051197; Sat, 18 Nov 2017 20:34:11 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id u68sm13955257pfu.154.2017.11.18.20.34.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:34:10 -0800 (PST) From: Arvind Yadav To: arnd@arndb.de, gregkh@linuxfoundation.org, joel@jms.id.au, nicolas.ferre@microchip.com, alexandre.belloni@free-electrons.com, linux@armlinux.org.uk Subject: [PATCH 1/2 v3] misc: aspeed-lpc-snoop: Fix platform_get_irq's error checking Date: Sun, 19 Nov 2017 10:04:00 +0530 Message-Id: <3ce95a4e4eb4476b19868f36cd1f11e4b62b6203.1511065797.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_203431_743168_0DD4A6FF X-CRM114-Status: GOOD ( 10.32 ) 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav --- changes in v2 : Add failure case '<= 0' instead of '< 0'. IRQ 0 is not valid. changes in v3: Return -ENODEV instead of lpc_snoop->irq. drivers/misc/aspeed-lpc-snoop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c index cb78c98..e3be88f 100644 --- a/drivers/misc/aspeed-lpc-snoop.c +++ b/drivers/misc/aspeed-lpc-snoop.c @@ -115,7 +115,7 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop, int rc; lpc_snoop->irq = platform_get_irq(pdev, 0); - if (!lpc_snoop->irq) + if (lpc_snoop->irq <= 0) return -ENODEV; rc = devm_request_irq(dev, lpc_snoop->irq,