Skip to content

Commit 2555906

Browse files
Qianqiang Liuhdeller
authored andcommitted
fbcon: break earlier in search_fb_in_map and search_for_mapped_con
Break the for loop immediately upon finding the target, making the process more efficient. Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent f1ebbe4 commit 2555906

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/video/fbdev/core/fbcon.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,10 @@ static int search_fb_in_map(int idx)
512512
int i, retval = 0;
513513

514514
for (i = first_fb_vc; i <= last_fb_vc; i++) {
515-
if (con2fb_map[i] == idx)
515+
if (con2fb_map[i] == idx) {
516516
retval = 1;
517+
break;
518+
}
517519
}
518520
return retval;
519521
}
@@ -523,8 +525,10 @@ static int search_for_mapped_con(void)
523525
int i, retval = 0;
524526

525527
for (i = first_fb_vc; i <= last_fb_vc; i++) {
526-
if (con2fb_map[i] != -1)
528+
if (con2fb_map[i] != -1) {
527529
retval = 1;
530+
break;
531+
}
528532
}
529533
return retval;
530534
}

0 commit comments

Comments
 (0)