From patchwork Sat Apr 11 12:08:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EB3BC2BA2B for ; Sat, 11 Apr 2020 12:29:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1861720644 for ; Sat, 11 Apr 2020 12:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586608143; bh=GqvXIaxjuuMVkWbvgmnDJJlqisLZZymgyjdUpE30ZoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LkCflHZQ5qcFtmenKMXxNyh5YKLk2tzNOVepjINpl1OPMz1JbsgbS/9aQWwOztR12 T4vv/fdPpH3AhcvymHocgNNDVcfCEGluH4qGZbMjDRT4WhrvHFvaFJy3V5uE0KjbyN a0/1h6d0WW4AY6kiSkiIHY4HKns4OpCh4DDypNyw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgDKM26 (ORCPT ); Sat, 11 Apr 2020 08:28:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:43828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbgDKMLl (ORCPT ); Sat, 11 Apr 2020 08:11:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72A3A21744; Sat, 11 Apr 2020 12:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607099; bh=GqvXIaxjuuMVkWbvgmnDJJlqisLZZymgyjdUpE30ZoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6l+u8KzNhNmkrKe/Aezuj9XLGhrSp55ELTnKaUVXe4+eDFybXxb1VcfgrwLP/8sH 8qPWWjAwaBG/3AWNcQdyEaix5ImHkxp6IRaLp9K4yfcuxAKwt5vi+bO9Bqi91p6Kzw 4tkXXzKD/j4H9kZYy6byAsJrDnYzWfjeV9z6qFoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Hans de Goede , Sebastian Reichel , "Nobuhiro Iwamatsu (CIP)" Subject: [PATCH 4.4 21/29] power: supply: axp288_charger: Fix unchecked return value Date: Sat, 11 Apr 2020 14:08:51 +0200 Message-Id: <20200411115411.408033079@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115407.651296755@linuxfoundation.org> References: <20200411115407.651296755@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gustavo A. R. Silva commit c3422ad5f84a66739ec6a37251ca27638c85b6be upstream. 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 Reviewed-by: Hans de Goede Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman Signed-off-by: Nobuhiro Iwamatsu (CIP) --- drivers/power/axp288_charger.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/power/axp288_charger.c +++ b/drivers/power/axp288_charger.c @@ -883,6 +883,10 @@ static int axp288_charger_probe(struct p /* 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,