[PATCH] staging/udlfb: Fix sparse warning 'Using plain integer as NULL pointer'

Dan Carpenter error27 at gmail.com
Tue Dec 7 22:40:40 UTC 2010


On Tue, Dec 07, 2010 at 11:16:41PM +0100, Peter Huewe wrote:
>  	while ((pixel_end > pixel) &&
>  	       (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) {
> -		uint8_t *raw_pixels_count_byte = 0;
> -		uint8_t *cmd_pixels_count_byte = 0;
> -		const uint16_t *raw_pixel_start = 0;
> -		const uint16_t *cmd_pixel_start, *cmd_pixel_end = 0;
> +		uint8_t *raw_pixels_count_byte = NULL;
> +		uint8_t *cmd_pixels_count_byte = NULL;
> +		const uint16_t *raw_pixel_start = NULL;
> +		const uint16_t *cmd_pixel_start, *cmd_pixel_end = NULL;
>  

It would be better to delete these.  The assignments are pointless and
may well end up generating warnings in future versions of gcc.  (Maybe
it already does with beta versions of gcc?)

> -		struct fb_videomode fb_vmode = {0};
> +		struct fb_videomode fb_vmode = {NULL};

Just do this:
		struct fb_videomode fb_vmode = {};

>  	struct usb_device *usbdev;
> -	struct dlfb_data *dev = 0;
> -	struct fb_info *info = 0;
> +	struct dlfb_data *dev = NULL;
> +	struct fb_info *info = NULL;
>  	int retval = -ENOMEM;
>  	int i;

You could leave dev uninitialized here again.

regards,
dan carpenter



More information about the devel mailing list