]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: loongson-64bit: Fix incorrect NULL check after devm_kcalloc()
authorChen Ni <nichen@iscas.ac.cn>
Thu, 5 Feb 2026 07:26:49 +0000 (15:26 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thu, 5 Feb 2026 17:00:45 +0000 (18:00 +0100)
Fix incorrect NULL check in loongson_gpio_init_irqchip().
The function checks chip->parent instead of chip->irq.parents.

Fixes: 03c146cb6cd1 ("gpio: loongson-64bit: Add support for Loongson-2K0300 SoC")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20260205072649.3271158-1-nichen@iscas.ac.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-loongson-64bit.c

index 77d07e31366fa4256b598748e175a5670f49d2a1..0fdf15faa344d2db0a1cf52dc52c3f58aabef49c 100644 (file)
@@ -263,7 +263,7 @@ static int loongson_gpio_init_irqchip(struct platform_device *pdev,
        chip->irq.num_parents = data->intr_num;
        chip->irq.parents = devm_kcalloc(&pdev->dev, data->intr_num,
                                         sizeof(*chip->irq.parents), GFP_KERNEL);
-       if (!chip->parent)
+       if (!chip->irq.parents)
                return -ENOMEM;
 
        for (i = 0; i < data->intr_num; i++) {