]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Feb 2026 12:42:00 +0000 (13:42 +0100)
[ Upstream commit e34f77b09080c86c929153e2a72da26b4f8947ff ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-loongson-64bit.c

index 82d4c3aa4d2fc7fe81dd620378b927b42f106bf3..d5573fb0616ce61ac9412023849e13922c64da47 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++) {