All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/aslint-sswi: request IO memory resource
@ 2025-12-09 14:23 Vladimir Kondratiev
  2025-12-15 21:47 ` [tip: irq/drivers] irqchip/aslint-sswi: Request " tip-bot2 for Vladimir Kondratiev
  2026-01-16 12:42 ` [PATCH] irqchip/aslint-sswi: request " Chris Mason
  0 siblings, 2 replies; 7+ messages in thread
From: Vladimir Kondratiev @ 2025-12-09 14:23 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Vladimir Kondratiev, Xu Lu, linux-kernel

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

Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
---
 drivers/irqchip/irq-aclint-sswi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
index 93e28e9f281f..0723f77a4307 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;
 

base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: irq/drivers] irqchip/aslint-sswi: Request IO memory resource
  2025-12-09 14:23 [PATCH] irqchip/aslint-sswi: request IO memory resource Vladimir Kondratiev
@ 2025-12-15 21:47 ` tip-bot2 for Vladimir Kondratiev
  2026-01-16 12:42 ` [PATCH] irqchip/aslint-sswi: request " Chris Mason
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Vladimir Kondratiev @ 2025-12-15 21:47 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Vladimir Kondratiev, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     8a7f030df89746842094334cdf55114d0fbb0234
Gitweb:        https://git.kernel.org/tip/8a7f030df89746842094334cdf55114d0fbb0234
Author:        Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
AuthorDate:    Tue, 09 Dec 2025 16:23:33 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 15 Dec 2025 22:44:31 +01:00

irqchip/aslint-sswi: Request IO memory resource

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

Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251209142336.1061606-1-vladimir.kondratiev@mobileye.com
---
 drivers/irqchip/irq-aclint-sswi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
index fee30f3..325501f 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;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] irqchip/aslint-sswi: request IO memory resource
  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
  2026-01-17 22:08   ` Thomas Gleixner
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Mason @ 2026-01-16 12:42 UTC (permalink / raw)
  To: Vladimir Kondratiev; +Cc: Chris Mason, Thomas Gleixner, Xu Lu, linux-kernel

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);
    }



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] irqchip/aslint-sswi: request IO memory resource
  2026-01-16 12:42 ` [PATCH] irqchip/aslint-sswi: request " Chris Mason
@ 2026-01-17 22:08   ` Thomas Gleixner
  2026-01-18  8:28     ` [PATCH] irqchip/aslint-sswi: fix error checking Vladimir Kondratiev
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2026-01-17 22:08 UTC (permalink / raw)
  To: Chris Mason, Vladimir Kondratiev; +Cc: Chris Mason, Xu Lu, linux-kernel

On Fri, Jan 16 2026 at 04:42, Chris Mason wrote:
> 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);
>     }

That's correct. Does anyone care to send a patch?

Thanks,

        tglx




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] irqchip/aslint-sswi: fix error checking
  2026-01-17 22:08   ` Thomas Gleixner
@ 2026-01-18  8:28     ` 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
  0 siblings, 2 replies; 7+ messages in thread
From: Vladimir Kondratiev @ 2026-01-18  8:28 UTC (permalink / raw)
  To: tglx; +Cc: clm, linux-kernel, luxu.kernel, vladimir.kondratiev

of_io_request_and_map() returns IOMEM_ERR_PTR() on failure which is
non-NULL.

Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
---
 drivers/irqchip/irq-aclint-sswi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
index 325501f34a9b..ca06efd86fa1 100644
--- a/drivers/irqchip/irq-aclint-sswi.c
+++ b/drivers/irqchip/irq-aclint-sswi.c
@@ -110,8 +110,10 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 		return -EINVAL;
 
 	reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
-	if (!reg)
-		return -ENOMEM;
+	if (IS_ERR(reg)) {
+		pr_err("%pfwP: Failed to map MMIO region\n", fwnode);
+		return PTR_ERR(reg);
+	}
 
 	/* Parse SSWI setting */
 	rc = aclint_sswi_parse_irq(fwnode, reg);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: irq/drivers] irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result
  2026-01-18  8:28     ` [PATCH] irqchip/aslint-sswi: fix error checking Vladimir Kondratiev
@ 2026-01-18 10:02       ` tip-bot2 for Vladimir Kondratiev
  2026-01-18 13:41       ` tip-bot2 for Vladimir Kondratiev
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Vladimir Kondratiev @ 2026-01-18 10:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Chris Mason, Vladimir Kondratiev, Thomas Gleixner, x86,
	linux-kernel

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     d9fbb5a1550516faa0d737ea2749e90d2b36d523
Gitweb:        https://git.kernel.org/tip/d9fbb5a1550516faa0d737ea2749e90d2b36d523
Author:        Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
AuthorDate:    Sun, 18 Jan 2026 10:28:43 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Sun, 18 Jan 2026 10:42:02 +01:00

irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result

of_io_request_and_map() returns IOMEM_ERR_PTR() on failure which is
non-NULL.

Fixes: 8a7f030df897 ("irqchip/aslint-sswi: Request IO memory resource")
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260118082843.2786630-1-vladimir.kondratiev@mobileye.com
Closes: https://lore.kernel.org/all/20260116124257.78357-1-clm@meta.com
---
 drivers/irqchip/irq-aclint-sswi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
index 325501f..ca06efd 100644
--- a/drivers/irqchip/irq-aclint-sswi.c
+++ b/drivers/irqchip/irq-aclint-sswi.c
@@ -110,8 +110,10 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 		return -EINVAL;
 
 	reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
-	if (!reg)
-		return -ENOMEM;
+	if (IS_ERR(reg)) {
+		pr_err("%pfwP: Failed to map MMIO region\n", fwnode);
+		return PTR_ERR(reg);
+	}
 
 	/* Parse SSWI setting */
 	rc = aclint_sswi_parse_irq(fwnode, reg);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: irq/drivers] irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result
  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
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Vladimir Kondratiev @ 2026-01-18 13:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Chris Mason, Vladimir Kondratiev, Thomas Gleixner, x86,
	linux-kernel

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     a384f2ed886d4417d50fdad78aaf1ccf870d62e6
Gitweb:        https://git.kernel.org/tip/a384f2ed886d4417d50fdad78aaf1ccf870d62e6
Author:        Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
AuthorDate:    Sun, 18 Jan 2026 10:28:43 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Sun, 18 Jan 2026 14:39:18 +01:00

irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result

of_io_request_and_map() returns IOMEM_ERR_PTR() on failure which is
non-NULL.

Fixes: 8a7f030df897 ("irqchip/aslint-sswi: Request IO memory resource")
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260118082843.2786630-1-vladimir.kondratiev@mobileye.com
Closes: https://lore.kernel.org/all/20260116124257.78357-1-clm@meta.com
---
 drivers/irqchip/irq-aclint-sswi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
index 325501f..ca06efd 100644
--- a/drivers/irqchip/irq-aclint-sswi.c
+++ b/drivers/irqchip/irq-aclint-sswi.c
@@ -110,8 +110,10 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 		return -EINVAL;
 
 	reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
-	if (!reg)
-		return -ENOMEM;
+	if (IS_ERR(reg)) {
+		pr_err("%pfwP: Failed to map MMIO region\n", fwnode);
+		return PTR_ERR(reg);
+	}
 
 	/* Parse SSWI setting */
 	rc = aclint_sswi_parse_irq(fwnode, reg);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-18 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] irqchip/aslint-sswi: request " Chris Mason
2026-01-17 22:08   ` 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

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.