Message ID | 20220609055533.95866-2-yang.lee@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next,1/2] spi: Remove unnecessary print function dev_err() | expand |
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.
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
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.
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; }
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 <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> --- drivers/spi/spi-microchip-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)