diff mbox series

ACPI, APEI, Fix incorrect return value of apei_map_generic_address

Message ID 20201102024726.8214-1-yaoaili126@163.com (mailing list archive)
State Not Applicable, archived
Headers show
Series ACPI, APEI, Fix incorrect return value of apei_map_generic_address | expand

Commit Message

yaoaili126@163.com Nov. 2, 2020, 2:47 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
pre_map_gar_callback and related apei_map_generic_address ,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.

Tested-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
---
 drivers/acpi/apei/apei-base.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tony Luck Nov. 3, 2020, 5:11 p.m. UTC | #1
On Sun, Nov 01, 2020 at 06:47:26PM -0800, 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
> pre_map_gar_callback and related apei_map_generic_address ,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.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
> Tested-by: Tony Luck <tony.luck@intel.com>

Yes. Tested this version too. Works fine.

-Tony
James Morse Nov. 6, 2020, 7:34 p.m. UTC | #2
Hello,

On 02/11/2020 02:47, 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
> pre_map_gar_callback and related apei_map_generic_address ,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.

(Nit: To make the commit message easier to read, please put '()' after function names, and
spaces after commas.)


> Tested-by: Tony Luck <tony.luck@intel.com>

> Signed-off-by: James Morse <james.morse@arm.com>

You can't add other peoples 'signed off'. This is for tracking the path a patch takes, and
that each person who touches it 'signs off' their changes for the open-source license. See
the 'Developer's Certificate of Origin 1.1' in Documentation/process/submitting-patches.rst'.

Please remove this tag.


> Signed-off-by: Aili Yao <yaoaili@kingsoft.com>

As this fixes the bug where the einj module can't be loaded, I think its appropriate for
the stable kernels. The tags to do that are:
Fixes: 6915564dc5a8 ("ACPI: OSL: Change the type of acpi_os_map_generic_address() return
value")
Cc: <stable@vger.kernel.org>


With that, please add my:
Reviewed-by: James Morse <james.morse@arm.com>


Thanks!

James



> diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
> index 552fd9ffaca4..3294cc8dc073 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;
>  
>
diff mbox series

Patch

diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 552fd9ffaca4..3294cc8dc073 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;