[AMD Official Use Only - Internal Distribution Only] Hi Yongjun, Thanks, Acked-by: Naveen krishna Chatradhi <nchatrad@xxxxxxx> -----Original Message----- From: linux-hwmon-owner@xxxxxxxxxxxxxxx <linux-hwmon-owner@xxxxxxxxxxxxxxx> On Behalf Of Wei Yongjun Sent: Wednesday, May 27, 2020 7:54 AM To: Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@xxxxxxx>; Jean Delvare <jdelvare@xxxxxxxx>; Guenter Roeck <linux@xxxxxxxxxxxx> Cc: Wei Yongjun <weiyongjun1@xxxxxxxxxx>; linux-hwmon@xxxxxxxxxxxxxxx; kernel-janitors@xxxxxxxxxxxxxxx; Hulk Robot <hulkci@xxxxxxxxxx> Subject: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init() [CAUTION: External Email] 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@xxxxxxxxxx> Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> --- drivers/hwmon/amd_energy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) {