diff options
author | Allen Hung <allen_hung@dell.com> | 2016-07-15 12:42:22 +0300 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2016-09-08 11:35:50 +0300 |
commit | 9b41b92bbae6a4d3e1f3adde87864fd481037814 (patch) | |
tree | 4d433b5ae15b28eea2fa6dd81fe9fe360c7391f2 /drivers | |
parent | d71f058617564750261b673ea9b3352382b9cde4 (diff) | |
download | linux-9b41b92bbae6a4d3e1f3adde87864fd481037814.tar.xz |
dmi-id: don't free dev structure after calling device_register
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firmware/dmi-id.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c index 94a58a082b99..44c01390d035 100644 --- a/drivers/firmware/dmi-id.c +++ b/drivers/firmware/dmi-id.c @@ -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; |