Re: [net 2/6] can: mcp251xfd: mcp251xfd_probe(): bail out if no IRQ was given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 27 Nov 2020 11:02:57 +0100 Marc Kleine-Budde wrote:
> This patch add a check to the mcp251xfd_probe() function to bail out and give
> the user a proper error message if no IRQ is specified. Otherwise the driver
> will probe just fine but ifup will fail with a meaningless "RTNETLINK answers:
> Invalid argument" error message.
> 
> Link: https://lore.kernel.org/r/20201123113522.3820052-1-mkl@xxxxxxxxxxxxxx
> Reported-by: Niels Petter <petter@xxxxxxxxxx>
> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> ---
>  drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 9c215f7c5f81..8a39be076e14 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> @@ -2738,6 +2738,10 @@ static int mcp251xfd_probe(struct spi_device *spi)
>  	u32 freq;
>  	int err;
>  
> +	if (!spi->irq)
> +		return dev_err_probe(&spi->dev, -ENXIO,
> +				     "No IRQ specified (maybe node \"interrupts-extended\" 

FWIW this looks like an abuse of dev_err_probe() to me. What's the point
of calling it with a constant err which is not EPROBE_DEFER?



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux