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 <[email protected]>
---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index 04639a4cb68..7ab48780332 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -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;
                        }
                }

---
base-commit: 021783860f7e628f7c4e0c101707cd4250e6d61f
change-id: 20250725-dwapb_gpio-1a7612ce69e3

Best regards,
-- 
Andrew Goodbody <[email protected]>

Reply via email to