Re: [PATCH 1/2] staging:iio:lpc32xx_adc: Fix IRQ check

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

 



On 10/16/13 21:45, Lars-Peter Clausen wrote:
> The test in the lpc32xx_adc driver which checks whether the IRQ number returned
> by platform_get_irq() has multiple problems. It accepts 0 even though this is an
> invalid IRQ. It also rejects IRQ numbers that are larger or equal than NR_IRQS.
> First of all drivers should never need to reference NR_IRQS and secondly with
> CONFIG_SPARSE_IRQ NR_IRQS is not the upper limit, so the check might reject
> valid IRQ numbers. This patch modifies the check to only test against less or
> equal to 0.
> 
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
> Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
> Cc: Roland Stigge <stigge@xxxxxxxxx>
Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/staging/iio/adc/lpc32xx_adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c
> index ce7ff3e..ef0a21d 100644
> --- a/drivers/staging/iio/adc/lpc32xx_adc.c
> +++ b/drivers/staging/iio/adc/lpc32xx_adc.c
> @@ -160,7 +160,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if ((irq < 0) || (irq >= NR_IRQS)) {
> +	if (irq <= 0) {
>  		dev_err(&pdev->dev, "failed getting interrupt resource\n");
>  		return -EINVAL;
>  	}
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux