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: 03c146cb6cd1 ("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>
return -ENOMEM;
for (i = 0; i < data->intr_num; i++) {
- chip->irq.parents[i] = platform_get_irq(pdev, i);
- if (chip->irq.parents[i] < 0)
- return dev_err_probe(&pdev->dev, chip->irq.parents[i],
+ int ret;
+
+ ret = platform_get_irq(pdev, i);
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
"failed to get IRQ %d\n", i);
+ chip->irq.parents[i] = ret;
}
for (i = 0; i < data->intr_num; i++) {