Re: [PATCH] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented

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

 




On 24/11/15 08:27, Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@xxxxxxxxxxxxx>
> 
> If diu_ops is not implemented on platform, kernel will access a null
> pointer. we need to check this pointer in diu initialization.
> 
> Signed-off-by: Wang Dongsheng <dongsheng.wang@xxxxxxxxxxxxx>
> 
> diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
> index b335c1a..288b5e4 100644
> --- a/drivers/video/fbdev/fsl-diu-fb.c
> +++ b/drivers/video/fbdev/fsl-diu-fb.c
> @@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
>  			port = FSL_DIU_PORT_DLVDS;
>  	}
>  
> -	return diu_ops.valid_monitor_port(port);
> +	if (diu_ops.valid_monitor_port)
> +		port = diu_ops.valid_monitor_port(port);
> +
> +	return port;
>  }
>  
>  /*
> @@ -1697,6 +1700,9 @@ static int fsl_diu_probe(struct platform_device *pdev)
>  	unsigned int i;
>  	int ret;
>  
> +	if (!diu_ops.set_pixel_clock)
> +		return -ENODEV;
> +
>  	data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
>  				   &dma_addr, GFP_DMA | __GFP_ZERO);
>  	if (!data)
> 

Thanks, queued for 4.5.

 Tomi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux