Skip to contentSkip to conversation

firmware: fix wrong memory deallocation in fw_add_devm_name()

PATCH In review Vladimir Zapolskiy 2 participants 2 messages Jul 29, 2015 – Jul 30, 2015 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: fix wrong memory deallocation in fw_add_devm_name()

Device resource data allocated with devres_alloc() must be deallocated by devres_free().

---
 drivers/base/firmware_class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_class.c +1 -1
index 894bda1..8524450 100644
@@ -443,7 +443,7 @@ static int fw_add_devm_name(struct device *dev, const char *name)
 		return -ENOMEM;
 	fwn->name = kstrdup_const(name, GFP_KERNEL);
 	if (!fwn->name) {
-		kfree(fwn);
+		devres_free(fwn);
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Vladimir Zapolskiy

Device resource data allocated with devres_alloc() must be deallocated by devres_free().

Quoted 20 lines
---
 drivers/base/firmware_class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_class.c +1 -2
index 894bda1..8524450 100644
@@ -443,7 +443,7 @@ static int fw_add_devm_name(struct device *dev, const char *name)
                return -ENOMEM;
        fwn->name = kstrdup_const(name, GFP_KERNEL);
        if (!fwn->name) {
-               kfree(fwn);
+               devres_free(fwn);
                return -ENOMEM;
        }
 
--

2.1.4