Skip to contentSkip to conversation

video: fbdev: uvesafb: Remove impossible code path in uvesafb_init_info

PATCH In review Wang YanQing 2 participants 2 messages Mar 5, 2014 – Mar 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: uvesafb: Remove impossible code path in uvesafb_init_info

Because uvesafb_vbe_init will fail when get zero avaiable modes, and we have checked the return value of uvesafb_vbe_init_mode, so it is impossible to pass NULL as mode into uvesafb_init_info.

[ This patch fix warning report by [email protected]
"drivers/video/fbdev/uvesafb.c:1509 uvesafb_init_info()
error: we previously assumed 'mode' could be null" ]

---
 drivers/video/fbdev/uvesafb.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/video/fbdev/uvesafb.c +1 -6
index 18352b2..509d452 100644
@@ -1474,12 +1474,7 @@ static void uvesafb_init_info(struct fb_info *info, struct vbe_mode_ib *mode)
 	 *                 used video mode, i.e. the minimum amount of
 	 *                 memory we need.
 	 */
-	if (mode != NULL) {
-		size_vmode = info->var.yres * mode->bytes_per_scan_line;
-	} else {
-		size_vmode = info->var.yres * info->var.xres *
-			     ((info->var.bits_per_pixel + 7) >> 3);
-	}
+	size_vmode = info->var.yres * mode->bytes_per_scan_line;
 
 	/*
 	 *   size_total -- all video memory we have. Used for mtrr
Signature · 1 line
1.8.3.4.8.g69490f3.dirty
#1 lore raw
Quoted 22 lines · Wang YanQing

Because uvesafb_vbe_init will fail when get zero avaiable modes, and we have checked the return value of uvesafb_vbe_init_mode, so it is impossible to pass NULL as mode into uvesafb_init_info.

[ This patch fix warning report by [email protected]
"drivers/video/fbdev/uvesafb.c:1509 uvesafb_init_info()
error: we previously assumed 'mode' could be null" ]

---
 drivers/video/fbdev/uvesafb.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/video/fbdev/uvesafb.c +0 -0
index 18352b2..509d452 100644
@@ -1474,12 +1474,7 @@ static void uvesafb_init_info(struct fb_info *info, struct vbe_mode_ib *mode)
 	 *                 used video mode, i.e. the minimum amount of
 	 *                 memory we need.
 	 */

drivers/video/fbdev/uvesafb.c static void uvesafb_init_info(struct fb_info *info, struct vbe_mode_ib *mode) · line 1480

Quoted 10 lines
drivers/video/fbdev/uvesafb.c +1 -6
-	if (mode != NULL) {
-		size_vmode = info->var.yres * mode->bytes_per_scan_line;
-	} else {
-		size_vmode = info->var.yres * info->var.xres *
-			     ((info->var.bits_per_pixel + 7) >> 3);
-	}
+	size_vmode = info->var.yres * mode->bytes_per_scan_line;
 
 	/*
 	 *   size_total -- all video memory we have. Used for mtrr

Thanks, queuing for 3.15.

Tomi