mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Ma Ke" <make24@iscas.ac.cn>, "Vinod Koul" <vkoul@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] dmaengine: moxart: handle irq_of_parse_and_map() errors
Date: Sun, 18 Aug 2024 14:27:56 +0200	[thread overview]
Message-ID: <68f613a0-64c8-4c3c-915c-ce6e76eee317@app.fastmail.com> (raw)
In-Reply-To: <20240818071757.798601-1-make24@iscas.ac.cn>

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

  reply	other threads:[~2024-08-18 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18  7:17 Ma Ke
2024-08-18 12:27 ` Arnd Bergmann [this message]
2024-08-18 13:03 ` lock hey lee

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=68f613a0-64c8-4c3c-915c-ce6e76eee317@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /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 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®