Skip to content

Commit

Permalink
ACPI: ipmi: Remove address space handler in error path
Browse files Browse the repository at this point in the history
The acpi_install_address_space_handler() is coupled with
acpi_remove_address_space_handler() in ipmi module init/exit, but
it forgets to remove the handler in acpi_ipmi_init() if the
ipmi_smi_watcher_register() call fails, so add the removal of the
address space handler in error path.

Signed-off-by: Hanjun Guo <[email protected]>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
guohanjun authored and rafaeljw committed May 24, 2021
1 parent f00d2d3 commit 64887bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/acpi/acpi_ipmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,14 @@ static int __init acpi_ipmi_init(void)
pr_warn("Can't register IPMI opregion space handle\n");
return -EINVAL;
}

result = ipmi_smi_watcher_register(&driver_data.bmc_events);
if (result)
if (result) {
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_IPMI,
&acpi_ipmi_space_handler);
pr_err("Can't register IPMI system interface watcher\n");
}

return result;
}
Expand Down

0 comments on commit 64887bb

Please sign in to comment.