diff mbox series

[v2,10/19] fbcon: Ditch error handling for con2fb_release_oldinfo

Message ID 20220208210824.2238981-11-daniel.vetter@ffwll.ch (mailing list archive)
State Handled Elsewhere
Headers show
Series fbcon patches, take two | expand

Commit Message

Daniel Vetter Feb. 8, 2022, 9:08 p.m. UTC
It doesn't ever fail anymore.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Claudio Suarez <cssk@net-c.es>
Cc: Du Cheng <ducheng2@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 drivers/video/fbdev/core/fbcon.c | 37 +++++++++++---------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

Comments

Thomas Zimmermann Feb. 10, 2022, 2:14 p.m. UTC | #1
Am 08.02.22 um 22:08 schrieb Daniel Vetter:
> It doesn't ever fail anymore.
> 
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Claudio Suarez <cssk@net-c.es>
> Cc: Du Cheng <ducheng2@gmail.com>
> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/video/fbdev/core/fbcon.c | 37 +++++++++++---------------------
>   1 file changed, 13 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 3e1a3e7bf527..a60891005d44 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -739,9 +739,8 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
>   	return err;
>   }
>   
> -static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
> -				  struct fb_info *newinfo, int unit,
> -				  int oldidx, int found)
> +static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
> +				   struct fb_info *newinfo)
>   {
>   	struct fbcon_ops *ops = oldinfo->fbcon_par;
>   	int ret;
> @@ -770,8 +769,6 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
>   				"detected unhandled fb_set_par error, "
>   				"error code %d\n", ret);
>   	}
> -
> -	return 0;
>   }
>   
>   static void con2fb_init_display(struct vc_data *vc, struct fb_info *info,
> @@ -825,7 +822,7 @@ static int set_con2fb_map(int unit, int newidx, int user)
>   	int oldidx = con2fb_map[unit];
>   	struct fb_info *info = registered_fb[newidx];
>   	struct fb_info *oldinfo = NULL;
> -	int found, err = 0;
> +	int found, err = 0, show_logo;
>   
>   	WARN_CONSOLE_UNLOCKED();
>   
> @@ -854,18 +851,15 @@ static int set_con2fb_map(int unit, int newidx, int user)
>   	 * fbcon should release it.
>   	 */
>   	if (!err && oldinfo && !search_fb_in_map(oldidx))
> -		err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx,
> -					     found);
> +		con2fb_release_oldinfo(vc, oldinfo, info);
>   
> -	if (!err) {
> -		int show_logo = (fg_console == 0 && !user &&
> -				 logo_shown != FBCON_LOGO_DONTSHOW);
> +	show_logo = (fg_console == 0 && !user &&
> +			 logo_shown != FBCON_LOGO_DONTSHOW);
>   
> -		if (!found)
> -			fbcon_add_cursor_work(info);
> -		con2fb_map_boot[unit] = newidx;
> -		con2fb_init_display(vc, info, unit, show_logo);
> -	}
> +	if (!found)
> +		fbcon_add_cursor_work(info);
> +	con2fb_map_boot[unit] = newidx;
> +	con2fb_init_display(vc, info, unit, show_logo);
>   
>   	if (!search_fb_in_map(info_idx))
>   		info_idx = newidx;
> @@ -2769,7 +2763,7 @@ static inline void fbcon_unbind(void) {}
>   /* called with console_lock held */
>   void fbcon_fb_unbind(struct fb_info *info)
>   {
> -	int i, new_idx = -1, ret = 0;
> +	int i, new_idx = -1;
>   	int idx = info->node;
>   
>   	WARN_CONSOLE_UNLOCKED();
> @@ -2803,13 +2797,8 @@ void fbcon_fb_unbind(struct fb_info *info)
>   			if (con2fb_map[i] == idx) {
>   				con2fb_map[i] = -1;
>   				if (!search_fb_in_map(idx)) {
> -					ret = con2fb_release_oldinfo(vc_cons[i].d,
> -								     info, NULL, i,
> -								     idx, 0);
> -					if (ret) {
> -						con2fb_map[i] = idx;
> -						return;
> -					}
> +					con2fb_release_oldinfo(vc_cons[i].d,
> +							       info, NULL);
>   				}
>   			}
>   		}
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 3e1a3e7bf527..a60891005d44 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -739,9 +739,8 @@  static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
 	return err;
 }
 
-static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
-				  struct fb_info *newinfo, int unit,
-				  int oldidx, int found)
+static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
+				   struct fb_info *newinfo)
 {
 	struct fbcon_ops *ops = oldinfo->fbcon_par;
 	int ret;
@@ -770,8 +769,6 @@  static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
 				"detected unhandled fb_set_par error, "
 				"error code %d\n", ret);
 	}
-
-	return 0;
 }
 
 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info,
@@ -825,7 +822,7 @@  static int set_con2fb_map(int unit, int newidx, int user)
 	int oldidx = con2fb_map[unit];
 	struct fb_info *info = registered_fb[newidx];
 	struct fb_info *oldinfo = NULL;
-	int found, err = 0;
+	int found, err = 0, show_logo;
 
 	WARN_CONSOLE_UNLOCKED();
 
@@ -854,18 +851,15 @@  static int set_con2fb_map(int unit, int newidx, int user)
 	 * fbcon should release it.
 	 */
 	if (!err && oldinfo && !search_fb_in_map(oldidx))
-		err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx,
-					     found);
+		con2fb_release_oldinfo(vc, oldinfo, info);
 
-	if (!err) {
-		int show_logo = (fg_console == 0 && !user &&
-				 logo_shown != FBCON_LOGO_DONTSHOW);
+	show_logo = (fg_console == 0 && !user &&
+			 logo_shown != FBCON_LOGO_DONTSHOW);
 
-		if (!found)
-			fbcon_add_cursor_work(info);
-		con2fb_map_boot[unit] = newidx;
-		con2fb_init_display(vc, info, unit, show_logo);
-	}
+	if (!found)
+		fbcon_add_cursor_work(info);
+	con2fb_map_boot[unit] = newidx;
+	con2fb_init_display(vc, info, unit, show_logo);
 
 	if (!search_fb_in_map(info_idx))
 		info_idx = newidx;
@@ -2769,7 +2763,7 @@  static inline void fbcon_unbind(void) {}
 /* called with console_lock held */
 void fbcon_fb_unbind(struct fb_info *info)
 {
-	int i, new_idx = -1, ret = 0;
+	int i, new_idx = -1;
 	int idx = info->node;
 
 	WARN_CONSOLE_UNLOCKED();
@@ -2803,13 +2797,8 @@  void fbcon_fb_unbind(struct fb_info *info)
 			if (con2fb_map[i] == idx) {
 				con2fb_map[i] = -1;
 				if (!search_fb_in_map(idx)) {
-					ret = con2fb_release_oldinfo(vc_cons[i].d,
-								     info, NULL, i,
-								     idx, 0);
-					if (ret) {
-						con2fb_map[i] = idx;
-						return;
-					}
+					con2fb_release_oldinfo(vc_cons[i].d,
+							       info, NULL);
 				}
 			}
 		}