From: Thomas Gleixner <tglx@linutronix.de>
To: Ma Ke <make24@iscas.ac.cn>,
jochen@scram.de, andi.shyti@kernel.org, grant.likely@linaro.org,
thierry.reding@gmail.com, rob.herring@calxeda.com
Cc: linuxppc-dev@lists.ozlabs.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, Ma Ke <make24@iscas.ac.cn>,
stable@vger.kernel.org
Subject: Re: [PATCH] of/irq: handle irq_of_parse_and_map() errors
Date: Fri, 06 Sep 2024 16:36:30 +0200 [thread overview]
Message-ID: <87bk10etn5.ffs@tglx> (raw)
In-Reply-To: <20240830142127.3446406-1-make24@iscas.ac.cn>
On Fri, Aug 30 2024 at 22:21, 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.
The subsystem prefix is wrong. This changes drivers/i2c/busses/i2c-cpm.c
and has nothing to do with of/irq. Sure, the problem has been caused
by the commit below, but that's a different thing.
> Cc: stable@vger.kernel.org
> Fixes: f7578496a671 ("of/irq: Use irq_of_parse_and_map()")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
> drivers/i2c/busses/i2c-cpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index 4794ec066eb0..41e3c95c0ef7 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -435,7 +435,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)
> init_waitqueue_head(&cpm->i2c_wait);
>
> cpm->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
> - if (!cpm->irq)
> + if (cpm->irq <= 0)
> return -EINVAL;
The function _cannot return a negative number:
extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
So what is this actually fixing?
Thanks,
tglx
prev parent reply other threads:[~2024-09-06 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 14:21 [PATCH] of/irq: handle irq_of_parse_and_map() errors Ma Ke
2024-09-03 16:56 ` Christophe Leroy
2024-09-03 22:55 ` Andi Shyti
2024-09-06 14:36 ` Thomas Gleixner [this message]
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=87bk10etn5.ffs@tglx \
--to=tglx@linutronix.de \
--cc=andi.shyti@kernel.org \
--cc=grant.likely@linaro.org \
--cc=jochen@scram.de \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=make24@iscas.ac.cn \
--cc=rob.herring@calxeda.com \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/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 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.