summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_ipmi.c
diff options
context:
space:
mode:
authorHanjun Guo <guohanjun@huawei.com>2021-05-24 10:35:08 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-05-24 16:27:34 +0200
commit64887bbddae56cb808089a7b3d5247d1a71a1e7e (patch)
treef901d5114751f9e456522015d663f4f12b9a3167 /drivers/acpi/acpi_ipmi.c
parentACPI: event: Remove redundant initialization of local variable (diff)
downloadlinux-64887bbddae56cb808089a7b3d5247d1a71a1e7e.tar.xz
linux-64887bbddae56cb808089a7b3d5247d1a71a1e7e.zip
ACPI: ipmi: Remove address space handler in error path
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 <guohanjun@huawei.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_ipmi.c')
-rw-r--r--drivers/acpi/acpi_ipmi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index bbd00d96b7a8..a5fe2926bf50 100644
--- a/drivers/acpi/acpi_ipmi.c
+++ b/drivers/acpi/acpi_ipmi.c
@@ -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;
}