Commit 59dd36f4 authored by Wei Yongjun's avatar Wei Yongjun Committed by Guenter Roeck

hwmon: (amd_energy) Missing platform_driver_unregister() on error in amd_energy_init()

Add the missing platform_driver_unregister() before return
from amd_energy_init() in the error handling case.

Fixes: 8abee956 ("hwmon: Add amd_energy driver to report energy counters")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarNaveen krishna Chatradhi <nchatrad@amd.com>
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200527022417.105620-1-weiyongjun1@huawei.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 8054eadc
......@@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
return ret;
amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
if (!amd_energy_platdev)
if (!amd_energy_platdev) {
platform_driver_unregister(&amd_energy_driver);
return -ENOMEM;
}
ret = platform_device_add(amd_energy_platdev);
if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment