Skip to content

Commit 4c91b0e

Browse files
ColinIanKingBartosz Golaszewski
authored andcommitted
gpio: loongson-64bit: Fix a less than zero check on an unsigned int struct field
Currently the error check from the call to platform_get_irq is always false because an unsigned int chip->irq.parents[i] is being used to to perform the less than zero error check. Fix this by using the int variable ret to perform the check. Fixes: 03c146c ("gpio: loongson-64bit: Add support for Loongson-2K0300 SoC") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Reviewed-by: Yao Zi <ziyao@disroot.org> Link: https://lore.kernel.org/r/20250909190356.870000-1-colin.i.king@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 52bdd69 commit 4c91b0e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/gpio/gpio-loongson-64bit.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,13 @@ static int loongson_gpio_init_irqchip(struct platform_device *pdev,
267267
return -ENOMEM;
268268

269269
for (i = 0; i < data->intr_num; i++) {
270-
chip->irq.parents[i] = platform_get_irq(pdev, i);
271-
if (chip->irq.parents[i] < 0)
272-
return dev_err_probe(&pdev->dev, chip->irq.parents[i],
270+
int ret;
271+
272+
ret = platform_get_irq(pdev, i);
273+
if (ret < 0)
274+
return dev_err_probe(&pdev->dev, ret,
273275
"failed to get IRQ %d\n", i);
276+
chip->irq.parents[i] = ret;
274277
}
275278

276279
for (i = 0; i < data->intr_num; i++) {

0 commit comments

Comments
 (0)