mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 22:25:03 +00:00
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: 8abee9566b
("hwmon: Add amd_energy driver to report energy counters")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200527022417.105620-1-weiyongjun1@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
8054eadca7
commit
59dd36f41e
1 changed files with 3 additions and 1 deletions
|
@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
|
amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
|
||||||
if (!amd_energy_platdev)
|
if (!amd_energy_platdev) {
|
||||||
|
platform_driver_unregister(&amd_energy_driver);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
ret = platform_device_add(amd_energy_platdev);
|
ret = platform_device_add(amd_energy_platdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
Loading…
Reference in a new issue