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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Jul 2022 15:53:35 +0000 (17:53 +0200)
commit6b316eedff44f73f55299e0a812a0e021d5e95eb
treedd35cbeb0de8397adfb0e8ec1c8873d8e9ed7c12
parent8848842f0a9be483af03ff9fda0eca27bcdd3a5c
hwmon: (ibmaem) don't call platform_device_del() if platform_device_add() fails

[ Upstream commit d0e51022a025ca5350fafb8e413a6fe5d4baf833 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/ibmaem.c