From: Gustavo A. R. Silva Date: Mon, 18 Mar 2019 16:14:39 +0000 (-0500) Subject: power: supply: axp288_charger: Fix unchecked return value X-Git-Tag: Ubuntu-4.15.0-61.68~1776 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f5d22f1131d3a64d1adc57b33d22db5392fab38c;hp=2bba037f4cabb75f3b4e2c24f6f5deb56c3f8608;p=mirror_ubuntu-bionic-kernel.git power: supply: axp288_charger: Fix unchecked return value BugLink: https://bugs.launchpad.net/bugs/1838576 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: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 4d016fbc3527..b8f7da57c78a 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -881,6 +881,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,