mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
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: 8808a793f0
("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>
This commit is contained in:
parent
f0aa153b6c
commit
d0e51022a0
@ -550,7 +550,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
|
|||||||
|
|
||||||
res = platform_device_add(data->pdev);
|
res = platform_device_add(data->pdev);
|
||||||
if (res)
|
if (res)
|
||||||
goto ipmi_err;
|
goto dev_add_err;
|
||||||
|
|
||||||
platform_set_drvdata(data->pdev, data);
|
platform_set_drvdata(data->pdev, data);
|
||||||
|
|
||||||
@ -598,7 +598,9 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
|
|||||||
ipmi_destroy_user(data->ipmi.user);
|
ipmi_destroy_user(data->ipmi.user);
|
||||||
ipmi_err:
|
ipmi_err:
|
||||||
platform_set_drvdata(data->pdev, NULL);
|
platform_set_drvdata(data->pdev, NULL);
|
||||||
platform_device_unregister(data->pdev);
|
platform_device_del(data->pdev);
|
||||||
|
dev_add_err:
|
||||||
|
platform_device_put(data->pdev);
|
||||||
dev_err:
|
dev_err:
|
||||||
ida_free(&aem_ida, data->id);
|
ida_free(&aem_ida, data->id);
|
||||||
id_err:
|
id_err:
|
||||||
@ -690,7 +692,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
|
|||||||
|
|
||||||
res = platform_device_add(data->pdev);
|
res = platform_device_add(data->pdev);
|
||||||
if (res)
|
if (res)
|
||||||
goto ipmi_err;
|
goto dev_add_err;
|
||||||
|
|
||||||
platform_set_drvdata(data->pdev, data);
|
platform_set_drvdata(data->pdev, data);
|
||||||
|
|
||||||
@ -738,7 +740,9 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
|
|||||||
ipmi_destroy_user(data->ipmi.user);
|
ipmi_destroy_user(data->ipmi.user);
|
||||||
ipmi_err:
|
ipmi_err:
|
||||||
platform_set_drvdata(data->pdev, NULL);
|
platform_set_drvdata(data->pdev, NULL);
|
||||||
platform_device_unregister(data->pdev);
|
platform_device_del(data->pdev);
|
||||||
|
dev_add_err:
|
||||||
|
platform_device_put(data->pdev);
|
||||||
dev_err:
|
dev_err:
|
||||||
ida_free(&aem_ida, data->id);
|
ida_free(&aem_ida, data->id);
|
||||||
id_err:
|
id_err:
|
||||||
|
Loading…
Reference in New Issue
Block a user