Skip to content

Commit

Permalink
platform/x86: intel_pmc_ipc: adding error handling
Browse files Browse the repository at this point in the history
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: 48c1917 ("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>
  • Loading branch information
Junxiao Chang authored and Andy Shevchenko committed Apr 8, 2019
1 parent 9a4b33d commit e61985d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/platform/x86/intel_pmc_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,17 @@ static int ipc_create_pmc_devices(void)
if (ret) {
dev_err(ipcdev.dev, "Failed to add punit platform device\n");
platform_device_unregister(ipcdev.tco_dev);
return ret;
}

if (!ipcdev.telem_res_inval) {
ret = ipc_create_telemetry_device();
if (ret)
if (ret) {
dev_warn(ipcdev.dev,
"Failed to add telemetry platform device\n");
platform_device_unregister(ipcdev.punit_dev);
platform_device_unregister(ipcdev.tco_dev);
}
}

return ret;
Expand Down

0 comments on commit e61985d

Please sign in to comment.