diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2020-05-27 02:24:17 +0000 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2020-05-26 20:24:49 -0700 |
commit | 59dd36f41ea6a5c69c1f737125251df2ff8eb5ce (patch) | |
tree | 66ad655e0a88a99776e354c047c0ce82c03244f1 /drivers/hwmon/amd_energy.c | |
parent | 8054eadca71492f1c9421bcd58ac40f61d5e6e61 (diff) | |
download | lwn-59dd36f41ea6a5c69c1f737125251df2ff8eb5ce.tar.gz lwn-59dd36f41ea6a5c69c1f737125251df2ff8eb5ce.zip |
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: 8abee9566b7e ("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>
Diffstat (limited to 'drivers/hwmon/amd_energy.c')
-rw-r--r-- | drivers/hwmon/amd_energy.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index bc8b643a37d5..e95b7426106e 100644 --- a/drivers/hwmon/amd_energy.c +++ b/drivers/hwmon/amd_energy.c @@ -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) { |