2022-06-09 06:15:26

by Yang Li

[permalink] [raw]
Subject: [PATCH -next 2/2] spi: fix platform_no_drv_owner.cocci warning

Remove .owner field if calls are used which set it automatically.

Eliminate the following coccicheck warning:
./drivers/spi/spi-microchip-core.c:624:3-8: No need to set .owner here.
The core will do it.

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
drivers/spi/spi-microchip-core.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
index 5b2aee30fa04..3bd285dd4964 100644
--- a/drivers/spi/spi-microchip-core.c
+++ b/drivers/spi/spi-microchip-core.c
@@ -621,7 +621,6 @@ static struct platform_driver mchp_corespi_driver = {
.name = "microchip-corespi",
.pm = MICROCHIP_SPI_PM_OPS,
.of_match_table = of_match_ptr(mchp_corespi_dt_ids),
- .owner = THIS_MODULE,
},
.remove = mchp_corespi_remove,
};
--
2.20.1.7.g153144c


2022-06-09 06:50:16

by Yang Li

[permalink] [raw]
Subject: [PATCH -next 1/2] spi: Remove unnecessary print function dev_err()

The function platform_get_irq() never returns 0, and the print function
dev_err() is redundant because platform_get_irq() already prints an error.

Eliminate the follow coccicheck warning:
./drivers/spi/spi-microchip-core.c:543:2-9: line 543 is redundant
because platform_get_irq() already prints an error

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
drivers/spi/spi-microchip-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
index 3bd285dd4964..d8ae25ccffa8 100644
--- a/drivers/spi/spi-microchip-core.c
+++ b/drivers/spi/spi-microchip-core.c
@@ -539,8 +539,7 @@ static int mchp_corespi_probe(struct platform_device *pdev)
}

spi->irq = platform_get_irq(pdev, 0);
- if (spi->irq <= 0) {
- dev_err(&pdev->dev, "invalid IRQ %d for SPI controller\n", spi->irq);
+ if (spi->irq < 0) {
ret = spi->irq;
goto error_release_master;
}
--
2.20.1.7.g153144c

2022-06-09 11:07:03

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] spi: Remove unnecessary print function dev_err()

On Thu, Jun 09, 2022 at 01:55:33PM +0800, Yang Li wrote:
> The function platform_get_irq() never returns 0, and the print function
> dev_err() is redundant because platform_get_irq() already prints an error.

Are you sure it never returns 0? Note that 0 is a valid IRQ number on
some architectures.


Attachments:
(No filename) (306.00 B)
signature.asc (499.00 B)
Download all attachments

2022-06-09 14:22:18

by Mark Brown

[permalink] [raw]
Subject: Re: (subset) [PATCH -next 1/2] spi: Remove unnecessary print function dev_err()

On Thu, 9 Jun 2022 13:55:33 +0800, Yang Li wrote:
> The function platform_get_irq() never returns 0, and the print function
> dev_err() is redundant because platform_get_irq() already prints an error.
>
> Eliminate the follow coccicheck warning:
> ./drivers/spi/spi-microchip-core.c:543:2-9: line 543 is redundant
> because platform_get_irq() already prints an error
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[2/2] spi: fix platform_no_drv_owner.cocci warning
commit: a4f26ba2608c9ff736a9ad1348aa8078f0b03f81

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

2022-06-09 15:52:41

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] spi: Remove unnecessary print function dev_err()

On 09/06/2022 11:55, Mark Brown wrote:
> On Thu, Jun 09, 2022 at 01:55:33PM +0800, Yang Li wrote:
>> The function platform_get_irq() never returns 0, and the print function
>> dev_err() is redundant because platform_get_irq() already prints an error.
>
> Are you sure it never returns 0? Note that 0 is a valid IRQ number on
> some architectures.

If anything, I think I need to go in the other direction and make sure
that in my i2c and pwm drivers I also check for zero - it's an FPGA
after all.

Thanks,
Conor.