* [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()
@ 2024-08-20 8:42 Dan Carpenter
2024-08-20 8:54 ` Jinjie Ruan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-08-20 8:42 UTC (permalink / raw)
To: Anup Patel
Cc: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Björn Töpel, linux-riscv, linux-kernel,
kernel-janitors
The devm_platform_ioremap_resource() function doesn't return NULL, it
returns error pointers. Fix the error handling to match.
Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/irqchip/irq-riscv-aplic-main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index 28dd175b5764..981fad6fb8f7 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -175,9 +175,9 @@ static int aplic_probe(struct platform_device *pdev)
/* Map the MMIO registers */
regs = devm_platform_ioremap_resource(pdev, 0);
- if (!regs) {
+ if (IS_ERR(regs)) {
dev_err(dev, "failed map MMIO registers\n");
- return -ENOMEM;
+ return PTR_ERR(regs);
}
/*
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()
2024-08-20 8:42 [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe() Dan Carpenter
@ 2024-08-20 8:54 ` Jinjie Ruan
2024-08-20 9:19 ` Anup Patel
2024-08-20 15:12 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: Jinjie Ruan @ 2024-08-20 8:54 UTC (permalink / raw)
To: Dan Carpenter, Anup Patel
Cc: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Björn Töpel, linux-riscv, linux-kernel,
kernel-janitors
On 2024/8/20 16:42, Dan Carpenter wrote:
> The devm_platform_ioremap_resource() function doesn't return NULL, it
> returns error pointers. Fix the error handling to match.
>
> Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/irqchip/irq-riscv-aplic-main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
> index 28dd175b5764..981fad6fb8f7 100644
> --- a/drivers/irqchip/irq-riscv-aplic-main.c
> +++ b/drivers/irqchip/irq-riscv-aplic-main.c
> @@ -175,9 +175,9 @@ static int aplic_probe(struct platform_device *pdev)
>
> /* Map the MMIO registers */
> regs = devm_platform_ioremap_resource(pdev, 0);
> - if (!regs) {
> + if (IS_ERR(regs)) {
> dev_err(dev, "failed map MMIO registers\n");
> - return -ENOMEM;
> + return PTR_ERR(regs);
LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
> }
>
> /*
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()
2024-08-20 8:42 [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe() Dan Carpenter
2024-08-20 8:54 ` Jinjie Ruan
@ 2024-08-20 9:19 ` Anup Patel
2024-08-20 15:12 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: Anup Patel @ 2024-08-20 9:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Björn Töpel, linux-riscv, linux-kernel,
kernel-janitors
On Tue, Aug 20, 2024 at 2:12 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The devm_platform_ioremap_resource() function doesn't return NULL, it
> returns error pointers. Fix the error handling to match.
>
> Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
> ---
> drivers/irqchip/irq-riscv-aplic-main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
> index 28dd175b5764..981fad6fb8f7 100644
> --- a/drivers/irqchip/irq-riscv-aplic-main.c
> +++ b/drivers/irqchip/irq-riscv-aplic-main.c
> @@ -175,9 +175,9 @@ static int aplic_probe(struct platform_device *pdev)
>
> /* Map the MMIO registers */
> regs = devm_platform_ioremap_resource(pdev, 0);
> - if (!regs) {
> + if (IS_ERR(regs)) {
> dev_err(dev, "failed map MMIO registers\n");
> - return -ENOMEM;
> + return PTR_ERR(regs);
> }
>
> /*
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* [tip: irq/urgent] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()
2024-08-20 8:42 [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe() Dan Carpenter
2024-08-20 8:54 ` Jinjie Ruan
2024-08-20 9:19 ` Anup Patel
@ 2024-08-20 15:12 ` tip-bot2 for Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Dan Carpenter @ 2024-08-20 15:12 UTC (permalink / raw)
To: linux-tip-commits
Cc: Dan Carpenter, Thomas Gleixner, Jinjie Ruan, Anup Patel, stable,
x86, linux-kernel, maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: efe81b7bdf7d882d0ce3d183f1571321046da8f1
Gitweb: https://git.kernel.org/tip/efe81b7bdf7d882d0ce3d183f1571321046da8f1
Author: Dan Carpenter <dan.carpenter@linaro.org>
AuthorDate: Tue, 20 Aug 2024 11:42:40 +03:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 20 Aug 2024 17:05:32 +02:00
irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()
The devm_platform_ioremap_resource() function doesn't return NULL, it
returns error pointers. Fix the error handling to match.
Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/a5a628d6-81d8-4933-81a8-64aad4743ec4@stanley.mountain
---
drivers/irqchip/irq-riscv-aplic-main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index 28dd175..981fad6 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -175,9 +175,9 @@ static int aplic_probe(struct platform_device *pdev)
/* Map the MMIO registers */
regs = devm_platform_ioremap_resource(pdev, 0);
- if (!regs) {
+ if (IS_ERR(regs)) {
dev_err(dev, "failed map MMIO registers\n");
- return -ENOMEM;
+ return PTR_ERR(regs);
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-20 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 8:42 [PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe() Dan Carpenter
2024-08-20 8:54 ` Jinjie Ruan
2024-08-20 9:19 ` Anup Patel
2024-08-20 15:12 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®