]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Mon, 4 Jul 2022 14:51:33 +0000 (10:51 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 4 Jul 2022 14:51:33 +0000 (10:51 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch b/queue-4.9/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch
new file mode 100644 (file)
index 0000000..f0c7f7c
--- /dev/null
@@ -0,0 +1,71 @@
+From 6020094b482fce844ed8fd69256665469623136c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <yangyingliang@huawei.com>
+
+[ 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 | 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
+
index c16de3752504ddda57a9c089bc96ebad96c125f9..80318daf95a48924988bcb48f7804c957793f523 100644 (file)
@@ -11,3 +11,4 @@ net-bonding-fix-possible-null-deref-in-rlb-code.patch
 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
+hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch