Skip to content

Commit 7fddf0c

Browse files
junxiaocgregkh
authored andcommitted
platform/x86: intel_pmc_ipc: adding error handling
[ Upstream commit e61985d ] 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 <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8b19d72 commit 7fddf0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/platform/x86/intel_pmc_ipc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,17 @@ static int ipc_create_pmc_devices(void)
620620
if (ret) {
621621
dev_err(ipcdev.dev, "Failed to add punit platform device\n");
622622
platform_device_unregister(ipcdev.tco_dev);
623+
return ret;
623624
}
624625

625626
if (!ipcdev.telem_res_inval) {
626627
ret = ipc_create_telemetry_device();
627-
if (ret)
628+
if (ret) {
628629
dev_warn(ipcdev.dev,
629630
"Failed to add telemetry platform device\n");
631+
platform_device_unregister(ipcdev.punit_dev);
632+
platform_device_unregister(ipcdev.tco_dev);
633+
}
630634
}
631635

632636
return ret;

0 commit comments

Comments
 (0)