[Nouveau] [PATCH] device/tegra: fix uninitialized IRQ number

Lucas Stach dev at lynxeye.de
Tue Jan 26 12:44:06 PST 2016


Am Montag, den 25.01.2016, 18:44 +0900 schrieb Alexandre Courbot:
> nvkm_device_tegra_new initializes the irq member of the Tegra device
> to -1 in order to signal that it is uninitialized. However,
> nvkm_device_tegra_fini tests it against 0 to check whether an IRQ has
> been allocated or not. This leads to free_irq being called on -1
> during
> device initialization.
> 
The convention in other parts of the Linux kernel is that IRQ number 0
means unallocated/invalid IRQ. So I think it is the initialization to
-1 that should be fixed instead.

> Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
> ---
>  drm/nouveau/nvkm/engine/device/tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drm/nouveau/nvkm/engine/device/tegra.c
> b/drm/nouveau/nvkm/engine/device/tegra.c
> index 7f8a42721eb2..0a22439fd9ae 100644
> --- a/drm/nouveau/nvkm/engine/device/tegra.c
> +++ b/drm/nouveau/nvkm/engine/device/tegra.c
> @@ -195,9 +195,9 @@ static void
>  nvkm_device_tegra_fini(struct nvkm_device *device, bool suspend)
>  {
>  	struct nvkm_device_tegra *tdev = nvkm_device_tegra(device);
> -	if (tdev->irq) {
> +	if (tdev->irq != -1) {
>  		free_irq(tdev->irq, tdev);
> -		tdev->irq = 0;
> +		tdev->irq = -1;
>  	};
>  }
>  


More information about the Nouveau mailing list