Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp567041img; Mon, 18 Mar 2019 09:16:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+1UwnJPqDdE0+GpaQAS/BsjFfSY39hjW2unzOL/AnPPXmfnlXMHTUbwDGflJCyYqRAqQ/ X-Received: by 2002:aa7:90c7:: with SMTP id k7mr19687642pfk.186.1552925772960; Mon, 18 Mar 2019 09:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552925772; cv=none; d=google.com; s=arc-20160816; b=NJg2SJ+pGYd1jFeFSCJojk+9GnX+JXjL53JHF7miIJlzbEQqTFNFOUMw7L1GCGR7O5 SQQ9aXvew6Xrl1GZMzRNkQo6lPC0wfwPoU2ux6NMz6RCshtCEkwYBONsvZo5TqT1KpTh BE3V2z/AgcoC19DygZIH6KWoqyi657ePxjdUBpPys6Wuis4TmCu2QNZ/EhG1Rl1ifOUy 7GT0lwedKqjJ2qZGvyO4BVT7Cj4w8ERZOP8xSwWErufDp/QVE6oGvMCiA1aV5WUYC5o+ 0/EXfyDMz5P3dEierCzdtR1v8L5wrB2dxJ/BpqJpCRIpGLoddnqmXOudVxQ6eefaQwqC Bxjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=BDRXMQ3qYWBgyzQH4wxoRdXoH8Ps1LCYztVo4T3PNq8=; b=dW3AsrBV6B8m2P1hUuaJtQHGdXWF2PKB8fjCGcRF3Sgbqe94KBDfyk+1NfGOjxygLf 2SGcUask3EqFIeQ8l2OAZPwUfG1b+7xAugevnJd3JRfdTUsuSvzBROON1aoJ1Cr3GJEK oNCyN+tlBsi9P62z1LUADj1XKCkJldVwN04l0hZuT2JcdHw3uzn+p+MiIpw3oqeEBNIs hWlb0mxlfeogJ69ChIvYmAamHy1iEeCpV0ZrWe+BlW3f/TwhkppMdkQeAs1dtn8+uT4v qHNU2mNCGdGFJdWlQrlYVORSHbQfVyyJC6g6wacT9gDOmGKTOzhCLyFOLMrwKtRCiECh ersQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5si8860372pgp.496.2019.03.18.09.15.57; Mon, 18 Mar 2019 09:16:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727397AbfCRQPF (ORCPT + 99 others); Mon, 18 Mar 2019 12:15:05 -0400 Received: from gateway36.websitewelcome.com ([192.185.193.12]:37048 "EHLO gateway36.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfCRQPE (ORCPT ); Mon, 18 Mar 2019 12:15:04 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway36.websitewelcome.com (Postfix) with ESMTP id EC066400C88DF for ; Mon, 18 Mar 2019 10:31:13 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 5uukhpAFliQer5uukhdMDM; Mon, 18 Mar 2019 11:15:03 -0500 X-Authority-Reason: nr=8 Received: from [189.250.104.39] (port=39946 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1h5uuO-000W52-Gu; Mon, 18 Mar 2019 11:15:01 -0500 Date: Mon, 18 Mar 2019 11:14:39 -0500 From: "Gustavo A. R. Silva" To: Sebastian Reichel , Hans de Goede , Chen-Yu Tsai , Ramakrishna Pallala Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] power: supply: axp288_charger: Fix unchecked return value Message-ID: <20190318161439.GA6245@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.104.39 X-Source-L: No X-Exim-ID: 1h5uuO-000W52-Gu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.104.39]:39946 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 6 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently there is no check on platform_get_irq() return value in case it fails, hence never actually reporting any errors and causing unexpected behavior when using such value as argument for function regmap_irq_get_virq(). Fix this by adding a proper check, a message reporting any errors and returning *pirq* Addresses-Coverity-ID: 1443940 ("Improper use of negative value") Fixes: 843735b788a4 ("power: axp288_charger: axp288 charger driver") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva --- drivers/power/supply/axp288_charger.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index f8c6da9277b3..00b961890a38 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -833,6 +833,10 @@ static int axp288_charger_probe(struct platform_device *pdev) /* Register charger interrupts */ for (i = 0; i < CHRG_INTR_END; i++) { pirq = platform_get_irq(info->pdev, i); + if (pirq < 0) { + dev_err(&pdev->dev, "Failed to get IRQ: %d\n", pirq); + return pirq; + } info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); if (info->irq[i] < 0) { dev_warn(&info->pdev->dev, -- 2.21.0