Re: [PATCH] staging/udlfb: Fix sparse warning 'Using plain integeras NULL pointer'

From: Dan Carpenter
Date: Tue Dec 07 2010 - 17:41:03 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/