* [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
@ 2024-07-22 14:18 Ma Ke
2024-07-22 15:42 ` Markus Elfring
2024-08-15 13:32 ` [PATCH v3] " Mark Brown
0 siblings, 2 replies; 7+ messages in thread
From: Ma Ke @ 2024-07-22 14:18 UTC (permalink / raw)
To: broonie, jwboyer, dbrownell, sfalco, akpm, sr
Cc: linux-spi, linux-kernel, Ma Ke
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.
Fixes: 44dab88e7cc9 ("spi: add spi_ppc4xx driver")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
Changes in v3:
- removed Cc stable line as suggestions.
Changes in v2:
- added Cc stable line;
- added Fixes line.
---
drivers/spi/spi-ppc4xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 01fdecbf132d..599c29a31269 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -416,6 +416,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
if (hw->irqnum <= 0)
goto free_host;
+ if (hw->irqnum <= 0)
+ goto free_host;
+
ret = request_irq(hw->irqnum, spi_ppc4xx_int,
0, "spi_ppc4xx_of", (void *)hw);
if (ret) {
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-07-22 14:18 [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors Ma Ke
@ 2024-07-22 15:42 ` Markus Elfring
2024-07-22 17:10 ` Mark Brown
2024-08-15 13:32 ` [PATCH v3] " Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2024-07-22 15:42 UTC (permalink / raw)
To: make24, linux-spi
Cc: LKML, Andrew Morton, David Brownell, Josh Boyer, Mark Brown,
Stefan Roese, Steven A. Falco
…
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Will any contributors care more for rules also according to such information?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n398
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10#n5
…
> +++ b/drivers/spi/spi-ppc4xx.c
> @@ -416,6 +416,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
> if (hw->irqnum <= 0)
> goto free_host;
>
> + if (hw->irqnum <= 0)
> + goto free_host;
…
Why do you propose anyhow to add duplicate source code here?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-07-22 15:42 ` Markus Elfring
@ 2024-07-22 17:10 ` Mark Brown
2024-07-22 18:24 ` [v3] " Markus Elfring
2024-07-23 7:45 ` Markus Elfring
0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2024-07-22 17:10 UTC (permalink / raw)
To: Markus Elfring
Cc: make24, linux-spi, LKML, Andrew Morton, David Brownell,
Josh Boyer, Stefan Roese, Steven A. Falco
[-- Attachment #1: Type: text/plain, Size: 614 bytes --]
On Mon, Jul 22, 2024 at 05:42:23PM +0200, Markus Elfring wrote:
> …
> > Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>
> Will any contributors care more for rules also according to such information?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n398
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10#n5
Feel free to ignore Markus, he has a long history of sending
unhelpful review comments and continues to ignore repeated requests
to stop.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-07-22 17:10 ` Mark Brown
@ 2024-07-22 18:24 ` Markus Elfring
2024-07-23 7:45 ` Markus Elfring
1 sibling, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2024-07-22 18:24 UTC (permalink / raw)
To: Mark Brown, make24, linux-spi
Cc: LKML, Andrew Morton, Josh Boyer, Stefan Roese
>> …
>>> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>>
>> Will any contributors care more for rules also according to such information?
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n398
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10#n5
>
> Feel free to ignore Markus,
Form letter …?
> he has a long history of sending unhelpful review comments
The offered information can occasionally be handled in more constructive ways,
can't it?
> and continues to ignore repeated requests to stop.
I hope that circumstances will evolve somehow so that additional views
will trigger further positive effects.
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-07-22 17:10 ` Mark Brown
2024-07-22 18:24 ` [v3] " Markus Elfring
@ 2024-07-23 7:45 ` Markus Elfring
1 sibling, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2024-07-23 7:45 UTC (permalink / raw)
To: Mark Brown, make24, linux-spi
Cc: LKML, Andrew Morton, Josh Boyer, Stefan Roese
>> …
>>> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>>
>> Will any contributors care more for rules also according to such information?
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n398
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10#n5
>
> Feel free to ignore Markus,
May any contributors feel free also to reconsider such a hint?
> he has a long history of sending unhelpful review comments
Will the chances ever grow to clarify the concrete items
which you found questionable anyhow?
> and continues to ignore repeated requests to stop.
I would like to improve developments for selected software areas.
Will communication challenges be adjusted accordingly?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-07-22 14:18 [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors Ma Ke
2024-07-22 15:42 ` Markus Elfring
@ 2024-08-15 13:32 ` Mark Brown
2024-08-18 22:02 ` lee.lockhey
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2024-08-15 13:32 UTC (permalink / raw)
To: jwboyer, dbrownell, sfalco, akpm, sr, Ma Ke; +Cc: linux-spi, linux-kernel
On Mon, 22 Jul 2024 22:18:22 +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.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: ppc4xx: handle irq_of_parse_and_map() errors
commit: f1011ba20b83da3ee70dcb4a6d9d282a718916fa
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
2024-08-15 13:32 ` [PATCH v3] " Mark Brown
@ 2024-08-18 22:02 ` lee.lockhey
0 siblings, 0 replies; 7+ messages in thread
From: lee.lockhey @ 2024-08-18 22:02 UTC (permalink / raw)
To: Mark Brown
Cc: jwboyer, dbrownell, sfalco, akpm, sr, Ma Ke, linux-spi,
linux-kernel
Hello, Mark
On Mon, 22 Jul 2024 at 22:19, Ma Ke <make24@iscas.ac.cn> 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.
>
> Fixes: 44dab88e7cc9 ("spi: add spi_ppc4xx driver")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
> Changes in v3:
> - removed Cc stable line as suggestions.
> Changes in v2:
> - added Cc stable line;
> - added Fixes line.
> ---
> drivers/spi/spi-ppc4xx.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
> index 01fdecbf132d..599c29a31269 100644
> --- a/drivers/spi/spi-ppc4xx.c
> +++ b/drivers/spi/spi-ppc4xx.c
> @@ -416,6 +416,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
> if (hw->irqnum <= 0)
> goto free_host;
>
The repeated addition of code here is indeed confusing. :-)
> + if (hw->irqnum <= 0)
> + goto free_host;
> +
I noticed that this patch has been merged into the spi repository for-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git/commit/?id=f1011ba20b83da3ee70dcb4a6d9d282a718916fa
and there is also a related patch:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git/commit/?id=7781f1d120fec8624fc654eda900fc8748262082
The return type of the 'irq_of_parse_and_map' function is 'unsigned
int', here we use an 'int' type variable 'irq' to receive the interrupt number,
this might not be very accurate.
Would it be better to change the type of the 'irqnum' variable? and do
not need to check if 'irqnum' is negative, like this:
if (!hw->irqnum) {
dev_err(dev, "no IRQ resource\n");
ret = -EINVAL;
goto free_host;
}
> ret = request_irq(hw->irqnum, spi_ppc4xx_int,
> 0, "spi_ppc4xx_of", (void *)hw);
> if (ret) {
> --
> 2.25.1
>
>
Regards,
Luoxi
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-18 22:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 14:18 [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors Ma Ke
2024-07-22 15:42 ` Markus Elfring
2024-07-22 17:10 ` Mark Brown
2024-07-22 18:24 ` [v3] " Markus Elfring
2024-07-23 7:45 ` Markus Elfring
2024-08-15 13:32 ` [PATCH v3] " Mark Brown
2024-08-18 22:02 ` lee.lockhey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox