firmware: fix wrong memory deallocation in fw_add_devm_name()
authorVladimir Zapolskiy <vz@mleia.com>
Wed, 29 Jul 2015 20:26:28 +0000 (23:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2015 22:18:26 +0000 (15:18 -0700)
Device resource data allocated with devres_alloc() must be deallocated
by devres_free().

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c

index 894bda114224d667077c25c898025b1af83c590a..8524450e75bd15d8f97327af84662b4af32fc3a7 100644 (file)
@@ -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;
        }