From a1e1f25c6d050a09280e5a3f4728ceea8b0035c7 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 4 Jul 2022 10:51:32 -0400 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...-t-call-platform_device_del-if-platf.patch | 71 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 72 insertions(+) create mode 100644 queue-4.19/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch diff --git a/queue-4.19/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch b/queue-4.19/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch new file mode 100644 index 00000000000..98d9c95fa33 --- /dev/null +++ b/queue-4.19/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch @@ -0,0 +1,71 @@ +From 22488d377cce5027c3d30416d83f14f4501f2845 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Jul 2022 15:41:53 +0800 +Subject: hwmon: (ibmaem) don't call platform_device_del() if + platform_device_add() fails + +From: Yang Yingliang + +[ 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 +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20220701074153.4021556-1-yangyingliang@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/ibmaem.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c +index 1f643782ce04..c9cfc958e853 100644 +--- a/drivers/hwmon/ibmaem.c ++++ b/drivers/hwmon/ibmaem.c +@@ -563,7 +563,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) + + res = platform_device_add(data->pdev); + if (res) +- goto ipmi_err; ++ goto dev_add_err; + + platform_set_drvdata(data->pdev, data); + +@@ -611,7 +611,9 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) + ipmi_destroy_user(data->ipmi.user); + ipmi_err: + 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: + ida_simple_remove(&aem_ida, data->id); + id_err: +@@ -703,7 +705,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, + + res = platform_device_add(data->pdev); + if (res) +- goto ipmi_err; ++ goto dev_add_err; + + platform_set_drvdata(data->pdev, data); + +@@ -751,7 +753,9 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, + ipmi_destroy_user(data->ipmi.user); + ipmi_err: + 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: + ida_simple_remove(&aem_ida, data->id); + id_err: +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 3101d312b2e..8ba67c77f56 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -19,3 +19,4 @@ net-bonding-fix-use-after-free-after-802.3ad-slave-unbind.patch nfc-nfcmrvl-fix-irq_of_parse_and_map-return-value.patch nfc-nxp-nci-don-t-issue-a-zero-length-i2c_master_read.patch net-tun-avoid-disabling-napi-twice.patch +hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch -- 2.47.3