diff options
author | Denis Arefev <arefev@swemel.ru> | 2022-12-06 12:17:23 +0300 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2023-03-10 00:20:43 +0100 |
commit | bf6c880d5d1448489ebf92e2d13d5713ff644930 (patch) | |
tree | 609adc87075c7f1a0bca2dfefaadd3bf5d618984 /drivers/power | |
parent | 14c76b2e75bca4d96e2b85a0c12aa43e84fe3f74 (diff) |
power: supply: axp288_fuel_gauge: Added check for negative values
Variable 'pirq', which may receive negative value
in platform_get_irq().
Used as an index in a function regmap_irq_get_virq().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/axp288_fuel_gauge.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c index 8e6f8a655079..05f413178462 100644 --- a/drivers/power/supply/axp288_fuel_gauge.c +++ b/drivers/power/supply/axp288_fuel_gauge.c @@ -724,6 +724,8 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) for (i = 0; i < AXP288_FG_INTR_NUM; i++) { pirq = platform_get_irq(pdev, i); + if (pirq < 0) + continue; ret = regmap_irq_get_virq(axp20x->regmap_irqc, pirq); if (ret < 0) return dev_err_probe(dev, ret, "getting vIRQ %d\n", pirq); |