From 52374a6af2bf4d70fed70df7d001416396eab0f1 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 4 Jul 2022 10:51:33 -0400 Subject: [PATCH] Fixes for 4.9 Signed-off-by: Sasha Levin --- ...-t-call-platform_device_del-if-platf.patch | 71 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 72 insertions(+) create mode 100644 queue-4.9/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch 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 index 00000000000..f0c7f7cf307 --- /dev/null +++ b/queue-4.9/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch @@ -0,0 +1,71 @@ +From 6020094b482fce844ed8fd69256665469623136c 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.9/series b/queue-4.9/series index c16de375250..80318daf95a 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -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 -- 2.47.3