* [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors
@ 2024-08-18 7:17 Ma Ke
2024-08-18 12:27 ` Arnd Bergmann
2024-08-18 13:03 ` lock hey lee
0 siblings, 2 replies; 3+ messages in thread
From: Ma Ke @ 2024-08-18 7:17 UTC (permalink / raw)
To: vkoul, arnd, akpm; +Cc: dmaengine, linux-kernel, Ma Ke, stable
Zero and negative number is not a valid IRQ for in-kernel code and the
irq_of_parse_and_map() function returns zero on error. So this check for
valid IRQs should only accept values > 0.
Cc: stable@vger.kernel.org
Fixes: 2d9e31b9412c ("dmaengine: moxart: remove NO_IRQ")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
Changes in v3:
- added missed changelog v2.
Changes in v2:
- added Cc stable line;
- added Fixes line.
---
drivers/dma/moxart-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c
index 66dc6d31b603..16dd3c5aba4d 100644
--- a/drivers/dma/moxart-dma.c
+++ b/drivers/dma/moxart-dma.c
@@ -568,7 +568,7 @@ static int moxart_probe(struct platform_device *pdev)
return -ENOMEM;
irq = irq_of_parse_and_map(node, 0);
- if (!irq) {
+ if (irq <= 0) {
dev_err(dev, "no IRQ resource\n");
return -EINVAL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors
2024-08-18 7:17 [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors Ma Ke
@ 2024-08-18 12:27 ` Arnd Bergmann
2024-08-18 13:03 ` lock hey lee
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-08-18 12:27 UTC (permalink / raw)
To: Ma Ke, Vinod Koul, Andrew Morton; +Cc: dmaengine, linux-kernel, stable
On Sun, Aug 18, 2024, at 09:17, Ma Ke wrote:
> Zero and negative number is not a valid IRQ for in-kernel code and the
> irq_of_parse_and_map() function returns zero on error. So this check for
> valid IRQs should only accept values > 0.
>
> Cc: stable@vger.kernel.org
> Fixes: 2d9e31b9412c ("dmaengine: moxart: remove NO_IRQ")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
This makes no sense to me, you explain why the current code is
correct and then change it to something wrong?
> diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c
> index 66dc6d31b603..16dd3c5aba4d 100644
> --- a/drivers/dma/moxart-dma.c
> +++ b/drivers/dma/moxart-dma.c
> @@ -568,7 +568,7 @@ static int moxart_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> irq = irq_of_parse_and_map(node, 0);
> - if (!irq) {
> + if (irq <= 0) {
> dev_err(dev, "no IRQ resource\n");
> return -EINVAL;
The "if (!irq)" is clearly the intended check, as you explain
irq_of_parse_and_map() returns 0 on error.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors
2024-08-18 7:17 [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors Ma Ke
2024-08-18 12:27 ` Arnd Bergmann
@ 2024-08-18 13:03 ` lock hey lee
1 sibling, 0 replies; 3+ messages in thread
From: lock hey lee @ 2024-08-18 13:03 UTC (permalink / raw)
To: Ma Ke; +Cc: dmaengine, linux-kernel, stable
Hello Ma Ke,
On 2024/8/18 15:17:57 +0800, Ma Ke wrote:
>Zero and negative number is not a valid IRQ for in-kernel code and the
>irq_of_parse_and_map() function returns zero on error. So this check for
>valid IRQs should only accept values > 0.
>
>Cc: stable@vger.kernel.org
>Fixes: 2d9e31b9412c ("dmaengine: moxart: remove NO_IRQ")
>Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>---
>Changes in v3:
>- added missed changelog v2.
>Changes in v2:
>- added Cc stable line;
>- added Fixes line.
>---
> drivers/dma/moxart-dma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c
>index 66dc6d31b603..16dd3c5aba4d 100644
>--- a/drivers/dma/moxart-dma.c
>+++ b/drivers/dma/moxart-dma.c
>@@ -568,7 +568,7 @@ static int moxart_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> irq = irq_of_parse_and_map(node, 0);
>- if (!irq) {
>+ if (irq <= 0) {
The ’irq‘ variable type here is ‘unsigned int, which will never be negative, :-)
>
> dev_err(dev, "no IRQ resource\n");
> return -EINVAL;
> }
>--
>2.25.1
>
>
Thanks,
Luoxi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-18 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-18 7:17 [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors Ma Ke
2024-08-18 12:27 ` Arnd Bergmann
2024-08-18 13:03 ` lock hey lee
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®