aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel_pmc_ipc.c
diff options
context:
space:
mode:
authorJunxiao Chang <junxiao.chang@intel.com>2019-04-08 05:40:22 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-04-08 13:55:08 -0400
commite61985d0550df8c2078310202aaad9b41049c36c (patch)
tree319c00561ecc47a405489cca6995a179411d2aa6 /drivers/platform/x86/intel_pmc_ipc.c
parent9a4b33d4d22f3ff3fb1a24b8be5edae3be1c795d (diff)
platform/x86: intel_pmc_ipc: adding error handling
If punit or telemetry device initialization fails, pmc driver should unregister and return failure. This change is to fix a kernel panic when removing kernel module intel_pmc_ipc. Fixes: 48c1917088ba ("platform:x86: Add Intel telemetry platform device") Signed-off-by: Junxiao Chang <junxiao.chang@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/intel_pmc_ipc.c')
-rw-r--r--drivers/platform/x86/intel_pmc_ipc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
index 7964ba22ef8d..d37cbd1cf58c 100644
--- a/drivers/platform/x86/intel_pmc_ipc.c
+++ b/drivers/platform/x86/intel_pmc_ipc.c
@@ -771,13 +771,17 @@ static int ipc_create_pmc_devices(void)
771 if (ret) { 771 if (ret) {
772 dev_err(ipcdev.dev, "Failed to add punit platform device\n"); 772 dev_err(ipcdev.dev, "Failed to add punit platform device\n");
773 platform_device_unregister(ipcdev.tco_dev); 773 platform_device_unregister(ipcdev.tco_dev);
774 return ret;
774 } 775 }
775 776
776 if (!ipcdev.telem_res_inval) { 777 if (!ipcdev.telem_res_inval) {
777 ret = ipc_create_telemetry_device(); 778 ret = ipc_create_telemetry_device();
778 if (ret) 779 if (ret) {
779 dev_warn(ipcdev.dev, 780 dev_warn(ipcdev.dev,
780 "Failed to add telemetry platform device\n"); 781 "Failed to add telemetry platform device\n");
782 platform_device_unregister(ipcdev.punit_dev);
783 platform_device_unregister(ipcdev.tco_dev);
784 }
781 } 785 }
782 786
783 return ret; 787 return ret;