]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/platform-x86-intel_pmc_ipc-adding-error-handling.patch
Linux 4.19.51
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / platform-x86-intel_pmc_ipc-adding-error-handling.patch
1 From 5bb45ab51e910732a857d41fc5eeba77f50eb769 Mon Sep 17 00:00:00 2001
2 From: Junxiao Chang <junxiao.chang@intel.com>
3 Date: Mon, 8 Apr 2019 17:40:22 +0800
4 Subject: platform/x86: intel_pmc_ipc: adding error handling
5
6 [ Upstream commit e61985d0550df8c2078310202aaad9b41049c36c ]
7
8 If punit or telemetry device initialization fails, pmc driver should
9 unregister and return failure.
10
11 This change is to fix a kernel panic when removing kernel module
12 intel_pmc_ipc.
13
14 Fixes: 48c1917088ba ("platform:x86: Add Intel telemetry platform device")
15 Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
16 Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 drivers/platform/x86/intel_pmc_ipc.c | 6 +++++-
20 1 file changed, 5 insertions(+), 1 deletion(-)
21
22 diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
23 index e7edc8c63936..4ad9d127f2f5 100644
24 --- a/drivers/platform/x86/intel_pmc_ipc.c
25 +++ b/drivers/platform/x86/intel_pmc_ipc.c
26 @@ -776,13 +776,17 @@ static int ipc_create_pmc_devices(void)
27 if (ret) {
28 dev_err(ipcdev.dev, "Failed to add punit platform device\n");
29 platform_device_unregister(ipcdev.tco_dev);
30 + return ret;
31 }
32
33 if (!ipcdev.telem_res_inval) {
34 ret = ipc_create_telemetry_device();
35 - if (ret)
36 + if (ret) {
37 dev_warn(ipcdev.dev,
38 "Failed to add telemetry platform device\n");
39 + platform_device_unregister(ipcdev.punit_dev);
40 + platform_device_unregister(ipcdev.tco_dev);
41 + }
42 }
43
44 return ret;
45 --
46 2.20.1
47