All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <clm@meta.com>
To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Cc: Chris Mason <clm@meta.com>, Thomas Gleixner <tglx@linutronix.de>,
	Xu Lu <luxu.kernel@bytedance.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] irqchip/aslint-sswi: request IO memory resource
Date: Fri, 16 Jan 2026 04:42:49 -0800	[thread overview]
Message-ID: <20260116124257.78357-1-clm@meta.com> (raw)
In-Reply-To: <20251209142336.1061606-1-vladimir.kondratiev@mobileye.com>

On Tue,  9 Dec 2025 16:23:33 +0200 Vladimir Kondratiev <vladimir.kondratiev@mobileye.com> wrote:

> Make an aclint_sswi instance visible in the resource list,
> i.e. /proc/iomem
> 

Hi everyone,

I ran tip master through my AI review prompts, and this one was flagged.
This is a lot of words for NULL vs ERR_PTR, but it looks right to me:

> diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
> index fee30f3bc5ac2..325501f34a9bc 100644
> --- a/drivers/irqchip/irq-aclint-sswi.c
> +++ b/drivers/irqchip/irq-aclint-sswi.c
> @@ -109,7 +109,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
>  	if (!is_of_node(fwnode))
>  		return -EINVAL;
>
> -	reg = of_iomap(to_of_node(fwnode), 0);
> +	reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
>  	if (!reg)
>  		return -ENOMEM;

Should this error check be updated? of_iomap() returns NULL on failure,
but of_io_request_and_map() returns IOMEM_ERR_PTR() on failure which is
non-NULL.

When of_io_request_and_map() fails, the condition (!reg) will be false
and the function continues with an invalid ERR_PTR value. This gets passed
to aclint_sswi_parse_irq() which stores (reg + offset) into per_cpu
sswi_cpu_regs, leading to a crash when IPIs are later sent.

Other callers of of_io_request_and_map() in drivers/irqchip/ use IS_ERR()
for the error check. For example, sun6i_r_intc_init() in irq-sun6i-r.c:

    base = of_io_request_and_map(node, 0, NULL);
    if (IS_ERR(base)) {
        pr_err("%pOF: Failed to map MMIO region\n", node);
        return PTR_ERR(base);
    }



  parent reply	other threads:[~2026-01-16 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 14:23 [PATCH] irqchip/aslint-sswi: request IO memory resource Vladimir Kondratiev
2025-12-15 21:47 ` [tip: irq/drivers] irqchip/aslint-sswi: Request " tip-bot2 for Vladimir Kondratiev
2026-01-16 12:42 ` Chris Mason [this message]
2026-01-17 22:08   ` [PATCH] irqchip/aslint-sswi: request " Thomas Gleixner
2026-01-18  8:28     ` [PATCH] irqchip/aslint-sswi: fix error checking Vladimir Kondratiev
2026-01-18 10:02       ` [tip: irq/drivers] irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result tip-bot2 for Vladimir Kondratiev
2026-01-18 13:41       ` tip-bot2 for Vladimir Kondratiev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260116124257.78357-1-clm@meta.com \
    --to=clm@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luxu.kernel@bytedance.com \
    --cc=tglx@linutronix.de \
    --cc=vladimir.kondratiev@mobileye.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.