Skip to content

Commit c3422ad

Browse files
GustavoARSilvasre
authored andcommitted
power: supply: axp288_charger: Fix unchecked return value
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: 843735b ("power: axp288_charger: axp288 charger driver") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent f0459fe commit c3422ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/power/supply/axp288_charger.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,10 @@ static int axp288_charger_probe(struct platform_device *pdev)
833833
/* Register charger interrupts */
834834
for (i = 0; i < CHRG_INTR_END; i++) {
835835
pirq = platform_get_irq(info->pdev, i);
836+
if (pirq < 0) {
837+
dev_err(&pdev->dev, "Failed to get IRQ: %d\n", pirq);
838+
return pirq;
839+
}
836840
info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
837841
if (info->irq[i] < 0) {
838842
dev_warn(&info->pdev->dev,

0 commit comments

Comments
 (0)