From a57aa93f44f34ce6e3b3ed0b114d5eea46234aef Mon Sep 17 00:00:00 2001 From: Wang YanQing Date: Wed, 5 Mar 2014 23:54:18 +0800 Subject: video: fbdev: uvesafb: Remove redundant NULL check in uvesafb_remove Because uvesafb_par is allocated as part of fb_info in uvesafb_probe, so we don't need to do NULL check for both fb_info and uvesafb_par in uvesafb_remove. [ This patch also fix a warning report by fengguang.wu@intel.com "drivers/video/fbdev/uvesafb.c:1815 uvesafb_remove() warn: variable dereferenced before check 'par'" ] Signed-off-by: Wang YanQing Signed-off-by: Tomi Valkeinen --- drivers/video/uvesafb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/video/uvesafb.c') diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 256fba7f4641..70a02a2d60bf 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -1812,11 +1812,9 @@ static int uvesafb_remove(struct platform_device *dev) fb_destroy_modedb(info->monspecs.modedb); fb_dealloc_cmap(&info->cmap); - if (par) { - kfree(par->vbe_modes); - kfree(par->vbe_state_orig); - kfree(par->vbe_state_saved); - } + kfree(par->vbe_modes); + kfree(par->vbe_state_orig); + kfree(par->vbe_state_saved); framebuffer_release(info); } -- cgit v1.2.3 From 92559977ddf13748fc4a07ac0a2dfa1ff5132cac Mon Sep 17 00:00:00 2001 From: Wang YanQing Date: Wed, 5 Mar 2014 23:56:19 +0800 Subject: 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 fengguang.wu@intel.com "drivers/video/fbdev/uvesafb.c:1509 uvesafb_init_info() error: we previously assumed 'mode' could be null" ] Signed-off-by: Wang YanQing Signed-off-by: Tomi Valkeinen --- drivers/video/uvesafb.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/video/uvesafb.c') diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 70a02a2d60bf..17e262ecd4d0 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -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 -- cgit v1.2.3