From patchwork Sat Nov 18 10:55:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064759 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 12E4F60352 for ; Sat, 18 Nov 2017 10:57:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B4EF2A683 for ; Sat, 18 Nov 2017 10:57:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0030C2A6C6; Sat, 18 Nov 2017 10:57:13 +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 8531D2A683 for ; Sat, 18 Nov 2017 10:57:13 +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:References: In-Reply-To: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:List-Owner; bh=Lf1GaiIprxpK9v2iiWLdOLNRPM/flZHVEEpJrNjmgRs=; b=aOz7ZqUB5yNGBt0Q/yxKcYD56K QiveR+yh39UF5S69nnNpk2YsIRJepfUYOj3IF8mpQk6VOrm4DmKcjjREzABY8tCrqPoGeLTWtOqzm 49Rthx+CbLz31DvJ7aEluvBX1nuOZV8GR6JN8dhv9SDpTs6axMR4JKojA7cfGMJUEvGuwHQlbdQKl GCJkv9HxZdWdnsE4TyNaSC8MIwI8sYl6qK9fVUp1NkvhN1gmK5lgmDuK7Yyg6AnnaxhMftMBFRmVP dQ/TObQAS02ucZ07CoA0V9nFYHcpbOx+vt1hmweCLYhIFq71iV77N/LAOeLaXpff4o45n3M45ejx7 2nNq5hhA==; 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 1eG0oC-0006fV-FI; Sat, 18 Nov 2017 10:57:12 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eG0n4-0005Vr-By for linux-arm-kernel@lists.infradead.org; Sat, 18 Nov 2017 10:56:10 +0000 Received: by mail-pf0-x242.google.com with SMTP id d28so3829278pfe.2 for ; Sat, 18 Nov 2017 02:55:40 -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:in-reply-to:references :in-reply-to:references; bh=wo4RVwk0WOYUao/9YgE9Xwa5k9ZhUjeO+R4/MLwMYkc=; b=MgA/4W0fa0zdqZH/2NSj7h/s2cjklUf2IMAy3KyvKYjuAf6Tq9OBPDRu8fL/wqeGQ4 +GjUwPI6FMRX+kZWKOdVKLvyZM2936mddBc/EoUZnsI4sqL9OY02hYFzM4AKXjRjjpbA WsLn0DLwGx8OPBHh+bDQHzZ61G80waoPGvqSV5mnoUpjBrayvJcV2SuPtu2yX6aODxlD tT0DgBOAnshY8kMmHijtaMYbMqXPsAqqC3HKeRzd1jzonWfCFoqWedu5h1ZPxUOoI4pC iszFr0h7VYbZgYRs2BP1fgcvkhUP32NYEEaBzmAahu4qQAmjnB2ZR+lJhZvlWLzYQNOI H8jg== 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:in-reply-to :references:in-reply-to:references; bh=wo4RVwk0WOYUao/9YgE9Xwa5k9ZhUjeO+R4/MLwMYkc=; b=G8tdLwR9IkXiA6LAvSogF2ey+fpqFF8+mj/gg9w4mTczzyrlbcZ3eAEU2A4Rlr/YIm DOvtAw/V0KKDx7QwquF2x/hlovl/CUGrvV0odcXXUF1jpAMQaF2tpkyzzKM1OAxuDUsn PLHnf8cpiDc/zUwM2/vHE6iqgkl4HeY0VIDb1FyWh1fmn6vOcNVlgsqGJB2HUGgCDa1r +ol7ppOZv6mA2ycMAKxvOEAXOaw3DTfQsL9mCYR7ymOZoyGdht4DYHJnCgrYvJiY9/VM qGtKRm3TC9UwIy98T6s7I5v1AgO7acuGYrpiWtfa/QRoL8OdXoN1Cq9EZSgfGX3tm8gS +OUw== X-Gm-Message-State: AJaThX5AJEnomNDwCQhsqXVz0MwVcAOFKrzzQw+boSsEMdW0cT7owCYP D0UmIDd5KgrooB9qyXqja5g= X-Google-Smtp-Source: AGs4zMbu2dTOP03GlzYIWHgVj/Ry5tuL2EEM16fsVh8XSC1bZ4td/HzQzphTtyKFv628emugCskwkA== X-Received: by 10.99.120.131 with SMTP id t125mr7841562pgc.81.1511002539889; Sat, 18 Nov 2017 02:55:39 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id g7sm12321513pfj.13.2017.11.18.02.55.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 02:55:39 -0800 (PST) From: Arvind Yadav To: dmitry.torokhov@gmail.com, maxime.ripard@free-electrons.com, wens@csie.org, mcuos.com@gmail.com, linux@roeck-us.net, linux@armlinux.org.uk, lee.jones@linaro.org Subject: [PATCH 04/10 v3] Input: serio: Fix platform_get_irq's error checking Date: Sat, 18 Nov 2017 16:25:11 +0530 Message-Id: <8104ffc3b7bedee525c0cba9144cedaf04087fd4.1510999558.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_025602_785274_6B66FA76 X-CRM114-Status: GOOD ( 11.60 ) 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, linux-input@vger.kernel.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 : irq is unsigned. used struct sun4i_ps2data int variable drvdata->irq. changes in v3 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. drivers/input/serio/sun4i-ps2.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c index 04b96fe..38bb163 100644 --- a/drivers/input/serio/sun4i-ps2.c +++ b/drivers/input/serio/sun4i-ps2.c @@ -210,7 +210,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev) struct sun4i_ps2data *drvdata; struct serio *serio; struct device *dev = &pdev->dev; - unsigned int irq; int error; drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL); @@ -263,14 +262,13 @@ static int sun4i_ps2_probe(struct platform_device *pdev) writel(0, drvdata->reg_base + PS2_REG_GCTL); /* Get IRQ for the device */ - irq = platform_get_irq(pdev, 0); - if (!irq) { + drvdata->irq = platform_get_irq(pdev, 0); + if (drvdata->irq <= 0) { dev_err(dev, "no IRQ found\n"); - error = -ENXIO; + error = drvdata->irq; goto err_disable_clk; } - drvdata->irq = irq; drvdata->serio = serio; drvdata->dev = dev;