diff mbox

[1/2] spi: xilinx: Handle errors from platform_get_irq()

Message ID 1468329881-5894-1-git-send-email-lars@metafoo.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lars-Peter Clausen July 12, 2016, 1:24 p.m. UTC
The Xilinx SPI driver can operate without an IRQ, but not every error
returned by platform_get_irq() means that no IRQ was specified. It will
also return an error if the IRQ specification is invalid or the IRQ
provider is not yet available (EPROBE_DEFER).

So instead of ignoring all errors only ignore ENXIO, which means no IRQ was
specified, and propagate all other errors to device driver core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/spi/spi-xilinx.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ricardo Ribalda Delgado July 12, 2016, 1:31 p.m. UTC | #1
A good one. I did not think about it.

Thanks!

Acked-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

On Tue, Jul 12, 2016 at 3:24 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> The Xilinx SPI driver can operate without an IRQ, but not every error
> returned by platform_get_irq() means that no IRQ was specified. It will
> also return an error if the IRQ specification is invalid or the IRQ
> provider is not yet available (EPROBE_DEFER).
>
> So instead of ignoring all errors only ignore ENXIO, which means no IRQ was
> specified, and propagate all other errors to device driver core.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/spi/spi-xilinx.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index 3009121..334f423 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -455,6 +455,9 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>         xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
>
>         xspi->irq = platform_get_irq(pdev, 0);
> +       if (xspi->irq < 0 && xspi->irq != -ENXIO)
> +               return xspi->irq;
> +
>         if (xspi->irq >= 0) {
>                 /* Register for SPI Interrupt */
>                 ret = devm_request_irq(&pdev->dev, xspi->irq, xilinx_spi_irq, 0,
> --
> 2.1.4
>
Lars-Peter Clausen July 12, 2016, 1:48 p.m. UTC | #2
On 07/12/2016 03:24 PM, Lars-Peter Clausen wrote:
[...]
>  	xspi->irq = platform_get_irq(pdev, 0);
> +	if (xspi->irq < 0 && xspi->irq != -ENXIO)
> +		return xspi->irq;

Sorry, I messed up the error path handling here. Will fix it in v2.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 3009121..334f423 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -455,6 +455,9 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 	xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
 
 	xspi->irq = platform_get_irq(pdev, 0);
+	if (xspi->irq < 0 && xspi->irq != -ENXIO)
+		return xspi->irq;
+
 	if (xspi->irq >= 0) {
 		/* Register for SPI Interrupt */
 		ret = devm_request_irq(&pdev->dev, xspi->irq, xilinx_spi_irq, 0,