]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
gpio: dwapb_gpio: Using wrong function to free memory
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 25 Jul 2025 11:48:22 +0000 (12:48 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 11 Aug 2025 21:11:22 +0000 (15:11 -0600)
In gpio_dwapb_bind plat is used to reference memory allocated by
devm_kcalloc but it is attempted to be freed using kfree. Instead free
this memory using the correct devm_kfree function.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Acked-by: Quentin Schulz <quentin.schulz@cherry.de>
drivers/gpio/dwapb_gpio.c

index 04639a4cb68262938578ef9a30fa495c05f3add4..7ab48780332282173ab9c93b0dbcb31e7dcc1acf 100644 (file)
@@ -193,7 +193,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
                                 ofnode_get_name(node));
                        plat->name = strdup(name);
                        if (!plat->name) {
-                               kfree(plat);
+                               devm_kfree(dev, plat);
                                return -ENOMEM;
                        }
                }