Re: [PATCH v4 3/9] ACPI: APEI: EINJ: Fix kernel test robot sparse warning

From: Jonathan Cameron
Date: Thu Mar 13 2025 - 05:50:39 EST


On Thu, 6 Mar 2025 15:48:04 -0800
Zaid Alali <zaidal@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> This patch fixes the kernel test robot warning reported here:
> https://lore.kernel.org/all/202410241620.oApALow5-lkp@xxxxxxxxx/
>
> Signed-off-by: Zaid Alali <zaidal@xxxxxxxxxxxxxxxxxxxxxx>
Follow up below.

> ---
> drivers/acpi/apei/einj-core.c | 104 +++++++++++++++++++---------------
> 1 file changed, 59 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
> index 04731a5b01fa..b40ed44c4983 100644
> --- a/drivers/acpi/apei/einj-core.c
> +++ b/drivers/acpi/apei/einj-core.c
> @@ -149,7 +149,7 @@ static DEFINE_MUTEX(einj_mutex);
> */
> bool einj_initialized __ro_after_init;
>
> -static void *einj_param;
> +static void __iomem *einj_param;
>
> static void einj_exec_ctx_init(struct apei_exec_context *ctx)
> {
> @@ -214,21 +214,23 @@ static void check_vendor_extension(u64 paddr,
> struct set_error_type_with_address *v5param)
> {
> int offset = v5param->vendor_extension;
> - struct vendor_error_type_extension *v;
> + struct vendor_error_type_extension v;
> + void __iomem *p;
> u32 sbdf;
>
> if (!offset)
> return;
> - v = acpi_os_map_iomem(paddr + offset, sizeof(*v));
> - if (!v)
> + p = acpi_os_map_iomem(paddr + offset, sizeof(v));
> + if (!p)
> return;
> - get_oem_vendor_struct(paddr, offset, v);
> - sbdf = v->pcie_sbdf;
> + memcpy_fromio(&v, p, sizeof(v));
> + get_oem_vendor_struct(paddr, offset, &v);
> + sbdf = v.pcie_sbdf;
> sprintf(vendor_dev, "%x:%x:%x.%x vendor_id=%x device_id=%x rev_id=%x\n",
> sbdf >> 24, (sbdf >> 16) & 0xff,
> (sbdf >> 11) & 0x1f, (sbdf >> 8) & 0x7,
> - v->vendor_id, v->device_id, v->rev_id);
> - acpi_os_unmap_iomem(v, sizeof(*v));
> + v.vendor_id, v.device_id, v.rev_id);
> + acpi_os_unmap_iomem(p, sizeof(v));
> }
>
> static void *einj_get_parameter_address(void)

Doesn't this return type want the __iomem marking as well?

> @@ -252,26 +254,30 @@ static void *einj_get_parameter_address(void)
> entry++;