Re: [PATCH 03/16] irqchip/sifive-plic: do not iounmap devm mappings

From: Anup Patel

Date: Tue Jul 14 2026 - 11:09:08 EST


On Tue, Jul 14, 2026 at 6:56 PM Haofeng Li <920484857@xxxxxx> wrote:
>
> From: Haofeng Li <lihaofeng@xxxxxxxxxx>
>
> plic_probe() maps registers with of_iomap() on the OF path, but with
> devm_platform_ioremap_resource() on the ACPI/platform path.
> fail_free_regs always calls iounmap(regs), which double-unmaps managed
> mappings on the non-OF path.

devm_platform_ioremap_resource() can't be used for OF because
we have one outlier platform "allwinner,sun20i-d1-plic" which still
relies on early irqchip probe using IRQCHIP_DECLARE() and
the platform device is not available in early irqchip probe.

>
> Only call iounmap(regs) when the fwnode is an OF node.
>
> Fixes: 206dd13a1011 ("irqchip/sifive-plic: Add ACPI support")
> Signed-off-by: Haofeng Li <lihaofeng@xxxxxxxxxx>

LGTM.

Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>

Thanks,
Anup


> --
> drivers/irqchip/irq-sifive-plic.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> index 5b0dac104814..0bddad388741 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -819,7 +819,9 @@ static int plic_probe(struct fwnode_handle *fwnode)
> fail_free_priv:
> kfree(priv);
> fail_free_regs:
> - iounmap(regs);
> + /* Only OF path uses of_iomap(); ACPI/platform uses devm mapping. */
> + if (is_of_node(fwnode))
> + iounmap(regs);
> return error;
> }
>
> --
> 2.25.1
>