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: 48c1917088
("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>
This commit is contained in:
parent
9a4b33d4d2
commit
e61985d055
@ -771,13 +771,17 @@ static int ipc_create_pmc_devices(void)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(ipcdev.dev, "Failed to add punit platform device\n");
|
dev_err(ipcdev.dev, "Failed to add punit platform device\n");
|
||||||
platform_device_unregister(ipcdev.tco_dev);
|
platform_device_unregister(ipcdev.tco_dev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipcdev.telem_res_inval) {
|
if (!ipcdev.telem_res_inval) {
|
||||||
ret = ipc_create_telemetry_device();
|
ret = ipc_create_telemetry_device();
|
||||||
if (ret)
|
if (ret) {
|
||||||
dev_warn(ipcdev.dev,
|
dev_warn(ipcdev.dev,
|
||||||
"Failed to add telemetry platform device\n");
|
"Failed to add telemetry platform device\n");
|
||||||
|
platform_device_unregister(ipcdev.punit_dev);
|
||||||
|
platform_device_unregister(ipcdev.tco_dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user