From patchwork Fri Nov 24 17:01:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10074427 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 5907B6037F for ; Fri, 24 Nov 2017 17:02:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 490212A218 for ; Fri, 24 Nov 2017 17:02:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DB332A26D; Fri, 24 Nov 2017 17:02:01 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D73482A218 for ; Fri, 24 Nov 2017 17:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751018AbdKXRB7 (ORCPT ); Fri, 24 Nov 2017 12:01:59 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45190 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbdKXRB6 (ORCPT ); Fri, 24 Nov 2017 12:01:58 -0500 Received: by mail-pl0-f66.google.com with SMTP id f6so4722514pln.12; Fri, 24 Nov 2017 09:01:58 -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=AO0Y/XAoEWAnA7X9Vuz92LqF5vY25Kg5tassIxZJ4L0=; b=Er0nJ86baJ8uVBo2qaqkkjJfa01JLwa4w0UvQckC0I3dEqi+aruOgRHZDV8IyU3jJO FU9E6XZlzYtFijrwTUhSYWZyl7d8SMge9CFKR6aHTL9dke4HZFUhdocCTuoQxkGQLSSQ gcbvftEPgwyEaB2ECtODD8JuuAQtYkUdC8SFzN21PVM2E7SG9fjehsf7GlqkFwkNYp5d ey6Det5cq+wBPEHJ1OveVqA80FZBsAeRoJBCb3aZPIkTKb0MRhmvH2yECAxgmgDAGP0v 76TTdc9FNmd8ljwZZChCj4qjACcgFbeRo8uGeRw05MMJVDrGcV3rQeVQYRgR8aOFaZPz Q/XQ== 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=AO0Y/XAoEWAnA7X9Vuz92LqF5vY25Kg5tassIxZJ4L0=; b=R25MvQJ9aRzHPXG9DQR/SHJtDbSoz++z6tOtfsY9OW0sI8gzRo3mBSwI4duPjITyl+ ktmAQKIjcDioSgzTyONiZRGS0Gbrbp/l+d8pV8NPBAiA0wj7LOx++w4Z5l9hoGkDNpT8 nLRnp9zjubfJZdFra7LiJ8LVvSTPaYDps5spzz0XY30HYroPuwwkTbQnPU9isOulNxHA oANpWk6NnsegF8RFmHZFSyFvJO2zdySRAvCu3tgnORGBvHNfLz4imBEk+MANdkPrT873 +b5NXOp9d0atRr7OAsQxpCH4CJffgFuWmyaRfTaIt3+VW/Ptpvo3PJ2qGqzx2ZdScta9 d4Bg== X-Gm-Message-State: AJaThX623Phz7qk1cBwajm6RHyNms36vYgCg4UWRCNME1xoYcD/g51kL U2XHKhUtelAnPJkc6sg7TIrxvw== X-Google-Smtp-Source: AGs4zMZRDxPnEVGQ3W4B0hv/P8TrJQprqDbHA7oHjk54M+6UU37tGXBy93wUkXqNSN2MItcA67bJHw== X-Received: by 10.84.129.70 with SMTP id 64mr29771327plb.444.1511542918097; Fri, 24 Nov 2017 09:01:58 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id d6sm39057294pfc.29.2017.11.24.09.01.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Nov 2017 09:01:56 -0800 (PST) From: Arvind Yadav To: sre@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH] power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking Date: Fri, 24 Nov 2017 22:31:40 +0530 Message-Id: <638d9bb5ac4c0ef44d3e83cc0f74d6e80cddcf7d.1511542695.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The platform_get_irq_byname() function returns -1 if an error occurs. zero or positive number on success. platform_get_irq_byname() error checking for zero is not correct. Signed-off-by: Arvind Yadav --- drivers/power/supply/cpcap-battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index ee71a2b..98ba078 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c @@ -586,8 +586,8 @@ static int cpcap_battery_init_irq(struct platform_device *pdev, int irq, error; irq = platform_get_irq_byname(pdev, name); - if (!irq) - return -ENODEV; + if (irq < 0) + return irq; error = devm_request_threaded_irq(ddata->dev, irq, NULL, cpcap_battery_irq_thread,