* [PATCH] irqchip/sifive-plic: Fix error codes
@ 2024-09-03 23:36 Charlie Jenkins
2024-10-01 11:17 ` Alexandre Ghiti
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Charlie Jenkins @ 2024-09-03 23:36 UTC (permalink / raw)
To: Thomas Gleixner, Paul Walmsley, Samuel Holland, Dan Carpenter,
Anup Patel
Cc: linux-kernel, linux-riscv, Charlie Jenkins, kernel test robot
Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
fails inside of plic_probe().
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
---
drivers/irqchip/irq-sifive-plic.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 2f6ef5c495bd..0b730e305748 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -626,8 +626,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
sizeof(*handler->enable_save), GFP_KERNEL);
- if (!handler->enable_save)
+ if (!handler->enable_save) {
+ error = -ENOMEM;
goto fail_cleanup_contexts;
+ }
done:
for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
plic_toggle(handler, hwirq, 0);
@@ -639,8 +641,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
priv->irqdomain = irq_domain_create_linear(fwnode, nr_irqs + 1,
&plic_irqdomain_ops, priv);
- if (WARN_ON(!priv->irqdomain))
+ if (WARN_ON(!priv->irqdomain)) {
+ error = -ENOMEM;
goto fail_cleanup_contexts;
+ }
/*
* We can have multiple PLIC instances so setup global state
---
base-commit: 6804f0edbe7747774e6ae60f20cec4ee3ad7c187
change-id: 20240903-correct_error_codes_sifive_plic-4611f59291df
--
- Charlie
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/sifive-plic: Fix error codes
2024-09-03 23:36 [PATCH] irqchip/sifive-plic: Fix error codes Charlie Jenkins
@ 2024-10-01 11:17 ` Alexandre Ghiti
2024-10-01 11:54 ` Anup Patel
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Ghiti @ 2024-10-01 11:17 UTC (permalink / raw)
To: Charlie Jenkins, Thomas Gleixner, Paul Walmsley, Samuel Holland,
Dan Carpenter, Anup Patel
Cc: linux-kernel, linux-riscv, kernel test robot
Hi Charlie,
On 04/09/2024 01:36, Charlie Jenkins wrote:
> Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
> fails inside of plic_probe().
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
I found the following Fixes tag:
Fixes: 4d936f10ff80 ("irqchip/sifive-plic: Probe plic driver early for
Allwinner D1 platform")
> ---
> drivers/irqchip/irq-sifive-plic.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> index 2f6ef5c495bd..0b730e305748 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -626,8 +626,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
>
> handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
> sizeof(*handler->enable_save), GFP_KERNEL);
> - if (!handler->enable_save)
> + if (!handler->enable_save) {
> + error = -ENOMEM;
This is correct.
> goto fail_cleanup_contexts;
> + }
> done:
> for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
> plic_toggle(handler, hwirq, 0);
> @@ -639,8 +641,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
>
> priv->irqdomain = irq_domain_create_linear(fwnode, nr_irqs + 1,
> &plic_irqdomain_ops, priv);
> - if (WARN_ON(!priv->irqdomain))
> + if (WARN_ON(!priv->irqdomain)) {
> + error = -ENOMEM;
Here though I found drivers that return either ENODEV
(https://elixir.bootlin.com/linux/v6.11/source/drivers/irqchip/irq-gic.c#L1210)
or ENOMEM
(https://elixir.bootlin.com/linux/v6.11/source/drivers/irqchip/irq-imx-mu-msi.c#L229).
Before the commit I mentioned above, we used to return ENOMEM. IMHO it's
not a big deal as long as we return something different from 0 in that
case, I just mention it if someone thinks differently.
You can add:
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
And I would also add:
Cc: stable@vger.kernel.org
Thanks,
Alex
> goto fail_cleanup_contexts;
> + }
>
> /*
> * We can have multiple PLIC instances so setup global state
>
> ---
> base-commit: 6804f0edbe7747774e6ae60f20cec4ee3ad7c187
> change-id: 20240903-correct_error_codes_sifive_plic-4611f59291df
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/sifive-plic: Fix error codes
2024-09-03 23:36 [PATCH] irqchip/sifive-plic: Fix error codes Charlie Jenkins
2024-10-01 11:17 ` Alexandre Ghiti
@ 2024-10-01 11:54 ` Anup Patel
2024-10-02 15:43 ` [tip: irq/urgent] irqchip/sifive-plic: Return error code on failure tip-bot2 for Charlie Jenkins
2024-11-12 22:53 ` [PATCH] irqchip/sifive-plic: Fix error codes patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: Anup Patel @ 2024-10-01 11:54 UTC (permalink / raw)
To: Charlie Jenkins
Cc: Thomas Gleixner, Paul Walmsley, Samuel Holland, Dan Carpenter,
Anup Patel, linux-kernel, linux-riscv, kernel test robot
On Wed, Sep 4, 2024 at 5:11 AM Charlie Jenkins <charlie@rivosinc.com> wrote:
>
> Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
> fails inside of plic_probe().
>
Like Alex mentioned, please include a Fixes tag.
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
> ---
> drivers/irqchip/irq-sifive-plic.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> index 2f6ef5c495bd..0b730e305748 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -626,8 +626,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
>
> handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
> sizeof(*handler->enable_save), GFP_KERNEL);
> - if (!handler->enable_save)
> + if (!handler->enable_save) {
> + error = -ENOMEM;
> goto fail_cleanup_contexts;
> + }
> done:
> for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
> plic_toggle(handler, hwirq, 0);
> @@ -639,8 +641,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
>
> priv->irqdomain = irq_domain_create_linear(fwnode, nr_irqs + 1,
> &plic_irqdomain_ops, priv);
> - if (WARN_ON(!priv->irqdomain))
> + if (WARN_ON(!priv->irqdomain)) {
> + error = -ENOMEM;
> goto fail_cleanup_contexts;
> + }
>
> /*
> * We can have multiple PLIC instances so setup global state
>
> ---
> base-commit: 6804f0edbe7747774e6ae60f20cec4ee3ad7c187
> change-id: 20240903-correct_error_codes_sifive_plic-4611f59291df
> --
> - Charlie
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: irq/urgent] irqchip/sifive-plic: Return error code on failure
2024-09-03 23:36 [PATCH] irqchip/sifive-plic: Fix error codes Charlie Jenkins
2024-10-01 11:17 ` Alexandre Ghiti
2024-10-01 11:54 ` Anup Patel
@ 2024-10-02 15:43 ` tip-bot2 for Charlie Jenkins
2024-11-12 22:53 ` [PATCH] irqchip/sifive-plic: Fix error codes patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Charlie Jenkins @ 2024-10-02 15:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, Dan Carpenter, Charlie Jenkins,
Thomas Gleixner, Anup Patel, Alexandre Ghiti, stable, x86,
linux-kernel, maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 6eabf656048d904d961584de2e1d45bc0854f9fb
Gitweb: https://git.kernel.org/tip/6eabf656048d904d961584de2e1d45bc0854f9fb
Author: Charlie Jenkins <charlie@rivosinc.com>
AuthorDate: Tue, 03 Sep 2024 16:36:19 -07:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Oct 2024 15:15:33 +02:00
irqchip/sifive-plic: Return error code on failure
Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
fails inside of plic_probe() instead of returning 0.
Fixes: 4d936f10ff80 ("irqchip/sifive-plic: Probe plic driver early for Allwinner D1 platform")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240903-correct_error_codes_sifive_plic-v1-1-d929b79663a2@rivosinc.com
Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
---
drivers/irqchip/irq-sifive-plic.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 2f6ef5c..0b730e3 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -626,8 +626,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
sizeof(*handler->enable_save), GFP_KERNEL);
- if (!handler->enable_save)
+ if (!handler->enable_save) {
+ error = -ENOMEM;
goto fail_cleanup_contexts;
+ }
done:
for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
plic_toggle(handler, hwirq, 0);
@@ -639,8 +641,10 @@ done:
priv->irqdomain = irq_domain_create_linear(fwnode, nr_irqs + 1,
&plic_irqdomain_ops, priv);
- if (WARN_ON(!priv->irqdomain))
+ if (WARN_ON(!priv->irqdomain)) {
+ error = -ENOMEM;
goto fail_cleanup_contexts;
+ }
/*
* We can have multiple PLIC instances so setup global state
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/sifive-plic: Fix error codes
2024-09-03 23:36 [PATCH] irqchip/sifive-plic: Fix error codes Charlie Jenkins
` (2 preceding siblings ...)
2024-10-02 15:43 ` [tip: irq/urgent] irqchip/sifive-plic: Return error code on failure tip-bot2 for Charlie Jenkins
@ 2024-11-12 22:53 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-11-12 22:53 UTC (permalink / raw)
To: Charlie Jenkins
Cc: linux-riscv, tglx, paul.walmsley, samuel.holland, dan.carpenter,
apatel, linux-kernel, lkp
Hello:
This patch was applied to riscv/linux.git (fixes)
by Thomas Gleixner <tglx@linutronix.de>:
On Tue, 03 Sep 2024 16:36:19 -0700 you wrote:
> Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
> fails inside of plic_probe().
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
>
> [...]
Here is the summary with links:
- irqchip/sifive-plic: Fix error codes
https://git.kernel.org/riscv/c/6eabf656048d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-12 22:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 23:36 [PATCH] irqchip/sifive-plic: Fix error codes Charlie Jenkins
2024-10-01 11:17 ` Alexandre Ghiti
2024-10-01 11:54 ` Anup Patel
2024-10-02 15:43 ` [tip: irq/urgent] irqchip/sifive-plic: Return error code on failure tip-bot2 for Charlie Jenkins
2024-11-12 22:53 ` [PATCH] irqchip/sifive-plic: Fix error codes patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox