Skip to contentSkip to conversation

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

PATCH In review Peter Huewe 2 participants 2 messages Dec 7, 2010 Staging

lore
Share & tools
lore
#0 lore raw

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

This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the offending 0s with NULL.

---
KernelVersion: linux-next-20101207

 drivers/staging/udlfb/udlfb.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/udlfb/udlfb.c +7 -7
index 8dd21e0..6586d38 100644
@@ -395,10 +395,10 @@ static void dlfb_compress_hline(
 
 	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;
 
 		prefetchw((void *) cmd); /* pull in one cache line at least */
 
@@ -1277,7 +1277,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
 	/* If everything else has failed, fall back to safe default mode */
 	if (default_vmode == NULL) {
 
-		struct fb_videomode fb_vmode = {0};
+		struct fb_videomode fb_vmode = {NULL};
 
 		/*
 		 * Add the standard VESA modes to our modelist
@@ -1533,8 +1533,8 @@ static int dlfb_usb_probe(struct usb_interface *interface,
 			const struct usb_device_id *id)
 {
 	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;
 
Signature · 1 line
1.7.2.2
#1 lore raw

drivers/staging/udlfb/udlfb.c static void dlfb_compress_hline( · line 401

Quoted 11 lines · Peter Huewe
drivers/staging/udlfb/udlfb.c +4 -4
 	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?)

drivers/staging/udlfb/udlfb.c static int dlfb_setup_modes(struct dlfb_data *dev, · line 1280

Quoted 2 lines
drivers/staging/udlfb/udlfb.c +1 -1
-		struct fb_videomode fb_vmode = {0};
+		struct fb_videomode fb_vmode = {NULL};

Just do this:

		struct fb_videomode fb_vmode = {};

drivers/staging/udlfb/udlfb.c static int dlfb_usb_probe(struct usb_interface *interface, · line 1539

Quoted 7 lines
drivers/staging/udlfb/udlfb.c +2 -2
 	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