diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-03-18 11:14:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-21 18:48:56 +0200 |
commit | 4bae1935546a935ee11a9f4da2610d6226970f41 (patch) | |
tree | 787cf2e80e03c27e38eb9bcef6bba521d2c8f0f5 | |
parent | f8646ad101e0dff3aa950743152417e54517e9a2 (diff) | |
download | linux-stable-4bae1935546a935ee11a9f4da2610d6226970f41.tar.gz linux-stable-4bae1935546a935ee11a9f4da2610d6226970f41.tar.bz2 linux-stable-4bae1935546a935ee11a9f4da2610d6226970f41.zip |
power: supply: axp288_charger: Fix unchecked return value
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 <gustavo@embeddedor.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/power/supply/axp288_charger.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 75b8e0c7402b..8a0a8fb915d6 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -899,6 +899,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, |