Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbcon: Move more code into fbcon_release

con2fb_release_oldinfo() has a bunch more kfree() calls than
fbcon_exit(), but since kfree() on NULL is harmless doing that in both
places should be ok. This is also a bit more symmetric now again with
fbcon_open also allocating the fbcon_ops structure.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Du Cheng <ducheng2@gmail.com>
Cc: Claudio Suarez <cssk@net-c.es>
Link: https://patchwork.freedesktop.org/patch/msgid/20220405210335.3434130-16-daniel.vetter@ffwll.ch

+13 -20
+13 -20
drivers/video/fbdev/core/fbcon.c
··· 690 690 unlock_fb_info(info); 691 691 692 692 module_put(info->fbops->owner); 693 + 694 + if (info->fbcon_par) { 695 + struct fbcon_ops *ops = info->fbcon_par; 696 + 697 + fbcon_del_cursor_work(info); 698 + kfree(ops->cursor_state.mask); 699 + kfree(ops->cursor_data); 700 + kfree(ops->cursor_src); 701 + kfree(ops->fontbuffer); 702 + kfree(info->fbcon_par); 703 + info->fbcon_par = NULL; 704 + } 693 705 } 694 706 695 707 static int fbcon_open(struct fb_info *info) ··· 752 740 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, 753 741 struct fb_info *newinfo) 754 742 { 755 - struct fbcon_ops *ops = oldinfo->fbcon_par; 756 743 int ret; 757 744 758 745 fbcon_release(oldinfo); 759 746 760 - fbcon_del_cursor_work(oldinfo); 761 - kfree(ops->cursor_state.mask); 762 - kfree(ops->cursor_data); 763 - kfree(ops->cursor_src); 764 - kfree(ops->fontbuffer); 765 - kfree(oldinfo->fbcon_par); 766 - oldinfo->fbcon_par = NULL; 767 747 /* 768 748 If oldinfo and newinfo are driving the same hardware, 769 749 the fb_release() method of oldinfo may attempt to ··· 3319 3315 } 3320 3316 } 3321 3317 3322 - if (mapped) { 3323 - if (info->fbcon_par) { 3324 - struct fbcon_ops *ops = info->fbcon_par; 3325 - 3326 - fbcon_del_cursor_work(info); 3327 - kfree(ops->cursor_src); 3328 - kfree(ops->cursor_state.mask); 3329 - kfree(info->fbcon_par); 3330 - info->fbcon_par = NULL; 3331 - } 3332 - 3318 + if (mapped) 3333 3319 fbcon_release(info); 3334 - } 3335 3320 } 3336 3321 } 3337 3322