]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
dmi-id: don't free dev structure after calling device_register
authorAllen Hung <allen_hung@dell.com>
Fri, 15 Jul 2016 09:42:22 +0000 (17:42 +0800)
committerJean Delvare <jdelvare@suse.de>
Thu, 8 Sep 2016 08:35:50 +0000 (10:35 +0200)
dmi_dev is freed in error exit code but, according to the document
of device_register, it should never directly free device structure
after calling this function, even if it returned an error! Use
put_device() instead.

Signed-off-by: Allen Hung <allen_hung@dell.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
drivers/firmware/dmi-id.c

index 94a58a082b9930a2acc05192273c6941ef003ef6..44c01390d0353fd3170fc797eb4ce6393229bd14 100644 (file)
@@ -229,14 +229,14 @@ static int __init dmi_id_init(void)
 
        ret = device_register(dmi_dev);
        if (ret)
-               goto fail_free_dmi_dev;
+               goto fail_put_dmi_dev;
 
        return 0;
 
-fail_free_dmi_dev:
-       kfree(dmi_dev);
-fail_class_unregister:
+fail_put_dmi_dev:
+       put_device(dmi_dev);
 
+fail_class_unregister:
        class_unregister(&dmi_class);
 
        return ret;