diff mbox series

ACPI, APEI, Fix error return value in apei_map_generic_address()

Message ID 20201110083334.456893-1-yaoaili126@163.com (mailing list archive)
State Mainlined, archived
Headers show
Series ACPI, APEI, Fix error return value in apei_map_generic_address() | expand

Commit Message

yaoaili126@163.com Nov. 10, 2020, 8:33 a.m. UTC
From: Aili Yao <yaoaili@kingsoft.com>

From commit 6915564dc5a8 ("ACPI: OSL: Change the type of
acpi_os_map_generic_address() return value"),
acpi_os_map_generic_address() will return logical address or NULL for
error, but for ACPI_ADR_SPACE_SYSTEM_IO case, it should be also return 0
as it's a normal case, but now it will return -ENXIO. So check it out for
such case to avoid einj module initialization fail.

Fixes: 6915564dc5a8 ("ACPI: OSL: Change the type of
acpi_os_map_generic_address() return value")
Cc: <stable@vger.kernel.org>
Reviewed-by: James Morse <james.morse@arm.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
---
 drivers/acpi/apei/apei-base.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Rafael J. Wysocki Nov. 16, 2020, 6:30 p.m. UTC | #1
On Tue, Nov 10, 2020 at 9:50 AM <yaoaili126@163.com> wrote:
>
> From: Aili Yao <yaoaili@kingsoft.com>
>
> From commit 6915564dc5a8 ("ACPI: OSL: Change the type of
> acpi_os_map_generic_address() return value"),
> acpi_os_map_generic_address() will return logical address or NULL for
> error, but for ACPI_ADR_SPACE_SYSTEM_IO case, it should be also return 0
> as it's a normal case, but now it will return -ENXIO. So check it out for
> such case to avoid einj module initialization fail.
>
> Fixes: 6915564dc5a8 ("ACPI: OSL: Change the type of
> acpi_os_map_generic_address() return value")
> Cc: <stable@vger.kernel.org>
> Reviewed-by: James Morse <james.morse@arm.com>
> Tested-by: Tony Luck <tony.luck@intel.com>
> Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
> ---
>  drivers/acpi/apei/apei-base.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
> index 552fd9f..3294cc8 100644
> --- a/drivers/acpi/apei/apei-base.c
> +++ b/drivers/acpi/apei/apei-base.c
> @@ -633,6 +633,10 @@ int apei_map_generic_address(struct acpi_generic_address *reg)
>         if (rc)
>                 return rc;
>
> +       /* IO space doesn't need mapping */
> +       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
> +               return 0;
> +
>         if (!acpi_os_map_generic_address(reg))
>                 return -ENXIO;
>
> --

Applied as 5.10-rc material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 552fd9f..3294cc8 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -633,6 +633,10 @@  int apei_map_generic_address(struct acpi_generic_address *reg)
 	if (rc)
 		return rc;
 
+	/* IO space doesn't need mapping */
+	if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
+		return 0;
+
 	if (!acpi_os_map_generic_address(reg))
 		return -ENXIO;