From patchwork Fri Nov 17 20:58:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064015 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 49C77601D3 for ; Fri, 17 Nov 2017 21:04:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B3492ADEE for ; Fri, 17 Nov 2017 21:04:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E4332ADF5; Fri, 17 Nov 2017 21:04:12 +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 B4C1F2ADEE for ; Fri, 17 Nov 2017 21:04:11 +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=Lv5YFfiq2ZXDB7bmJwzoA6lrmx0jZqDahpAvhWX+q5o=; b=qHuu2ECWp1AFPQ6Hd7ZI2hJuzT Vv1jSItUnVf9HHRGwzm7/lIe9b+GCOA919mDptuFqf0GAWCj1zOSKE6l/idC+aU1x2jcO0FOb08Ee xGiAspMe/iX7N2jaVy3wsw1UOA51tvHdzAeNAC7PFCCFY7M4rOwHOPNG9IozknG/ycviUI9PzKHwE HMCqy9vuBdt6jDE/nJXCLKKec37JiqYmOlHgB9IUjXw+2KXYjYf5RvzuZBeh4o30Kpw7zSyt6Uyc2 YXnCMbBUmVrYArCiOtbek/jHMc6muZ9y9/uyPaN0xG1zSMoAtxhVgDxfkq2YR/9AnWFXISdlrnRvz cjLsg2wA==; 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 1eFnnz-0002uz-UN; Fri, 17 Nov 2017 21:04:07 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFnjp-00074e-42 for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2017 20:59:53 +0000 Received: by mail-pg0-x242.google.com with SMTP id s75so2802988pgs.0 for ; Fri, 17 Nov 2017 12:59:28 -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=vxpOS8PLcNe+jmXIP+9QWAUopOfZBzCDoZVRFKo3uYg=; b=fICt1+hESnsABnSOSyu+/uO1k4dYFagPSuRORNqOI8+zXgYcVyDVZjsD80m798syxp mEJhCRn9d/0hNWHudGrQXnC0EGd4tEW8Nm7rZy4SqK1sYBDmjzGuLR4UJ57fnqKEtzuF AZ4jWZ9uNZ++NMRXIdMbisTr5U1U2IRTdyOLccebRFkBUw/s0NTw22E3zPjp3ehLGLKq D9ouu4xvTob69IqafftQ+GZkUth12NcxYU+U99NBeRHqKuww73SNGACDlozCkxI9EYb0 LYhR4+h7TP+qdNztdHCGweZlEjkVviNgC/5gV0LLyQ2p3MFp4hYXdSgvKiKG/GuXmcgI WWtA== 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=vxpOS8PLcNe+jmXIP+9QWAUopOfZBzCDoZVRFKo3uYg=; b=nfX7DI+sMkc13IGz9CPjWLJU39G+szQIpkN+xUkn/Iv4jb2L+ASivlqfJSypcPMEYe gP7Uy9vTMYpyWcHaOiluoDy6sym6IzExSI0Q7/utBsSgq5/5fJYFSoxgEbdvj2ZyaxvG kzk373l8yPef8H92KhCCiY9XyyPBd0inmibAN6iNDENfLQIrjGoll9hOYL14ghFjP1Bi bH8PwrEcV4tyNWfz/YIxjN6ARrz3By8djGDr+FS8EddIuubJK7ha0NiuFkzbOyHwmbzQ K9cX42x37dL10WRCfwmSNGPN7L3M3FGjJ2DrzFAltVQPbS20v2RYCG+6J8UXbTyZhk3v g9SA== X-Gm-Message-State: AJaThX42LHwgs0IwE+K/Ta4tw+jApUe3B54GqFR/H6NPOi0SDT9BmNP8 yzT9fgBCQmSoqULxPVBhZJI= X-Google-Smtp-Source: AGs4zMY/hiyi4AkTLg8lLrhAC4OcaIk2oNe0fuAX1bTe6Cdl93zDSlLkaAfjk3E47u4/cqh3k7SSIw== X-Received: by 10.84.175.3 with SMTP id s3mr6395895plb.440.1510952368266; Fri, 17 Nov 2017 12:59:28 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id f12sm7650857pga.7.2017.11.17.12.59.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Nov 2017 12:59:27 -0800 (PST) From: Arvind Yadav To: dmitry.torokhov@gmail.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@roeck-us.net, wsa@the-dreams.de, daniel.thompson@linaro.org, mcuos.com@gmail.com Subject: [PATCH 4/10 v2] Input: serio: Fix platform_get_irq's error checking Date: Sat, 18 Nov 2017 02:28:50 +0530 Message-Id: <8104ffc3b7bedee525c0cba9144cedaf04087fd4.1510951446.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-20171117_125949_829015_F9804513 X-CRM114-Status: GOOD ( 11.96 ) 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. 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;