OSDN Git Service

hwmon: (ibmaem) don't call platform_device_del() if platform_device_add() fails
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 1 Jul 2022 07:41:53 +0000 (15:41 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 1 Jul 2022 18:53:29 +0000 (11:53 -0700)
commitd0e51022a025ca5350fafb8e413a6fe5d4baf833
tree082924672ec70b493e872d3b2783d17883b2c0b8
parentf0aa153b6ce8018a052d9c05dc1b8483ac3a0f1a
hwmon: (ibmaem) don't call platform_device_del() if platform_device_add() fails

If platform_device_add() fails, it no need to call platform_device_del(), split
platform_device_unregister() into platform_device_del/put(), so platform_device_put()
can be called separately.

Fixes: 8808a793f052 ("ibmaem: new driver for power/energy/temp meters in IBM System X hardware")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220701074153.4021556-1-yangyingliang@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ibmaem.c