All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: ipmi: Remove address space handler in error path
@ 2021-05-24  8:35 Hanjun Guo
  2021-05-24 14:28 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Hanjun Guo @ 2021-05-24  8:35 UTC (permalink / raw)
  To: linux-acpi; +Cc: Rafael J. Wysocki, Hanjun Guo

The acpi_install_address_space_handler() is coupled with
acpi_remove_address_space_handler() in ipmi module init/exit, but failed
to remove the handler in acpi_ipmi_init() if the ipmi_smi_watcher_register()
failed, so adding the removal of the address space handler in error path.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
 drivers/acpi/acpi_ipmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index bbd00d9..a5fe292 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;
 }
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: ipmi: Remove address space handler in error path
  2021-05-24  8:35 [PATCH] ACPI: ipmi: Remove address space handler in error path Hanjun Guo
@ 2021-05-24 14:28 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-05-24 14:28 UTC (permalink / raw)
  To: Hanjun Guo; +Cc: ACPI Devel Maling List, Rafael J. Wysocki

On Mon, May 24, 2021 at 10:45 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> The acpi_install_address_space_handler() is coupled with
> acpi_remove_address_space_handler() in ipmi module init/exit, but failed
> to remove the handler in acpi_ipmi_init() if the ipmi_smi_watcher_register()
> failed, so adding the removal of the address space handler in error path.
>
> Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
> ---
>  drivers/acpi/acpi_ipmi.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
> index bbd00d9..a5fe292 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;
>  }
> --

Applied as 5.14 material with some edits in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-24 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:35 [PATCH] ACPI: ipmi: Remove address space handler in error path Hanjun Guo
2021-05-24 14:28 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.