From: Sasha Levin Date: Mon, 4 Jul 2022 14:51:33 +0000 (-0400) Subject: Fixes for 4.14 X-Git-Tag: v4.9.322~26^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77284b4e1a4f0146f7386534a0f69d55a8f6ba33;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch b/queue-4.14/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch new file mode 100644 index 00000000000..2709315e00a --- /dev/null +++ b/queue-4.14/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch @@ -0,0 +1,71 @@ +From 684935eacc77272ea4bb9cf959c39785383cb1bf 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.14/series b/queue-4.14/series index 79e8d981a1e..2ef361f1a8f 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -14,3 +14,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