diff options
author | Qianqiang Liu <qianqiang.liu@163.com> | 2024-09-26 19:59:11 +0800 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2024-09-26 18:25:12 +0200 |
commit | 2555906fd53e0a5239431d44fad695b420e94fdd (patch) | |
tree | f99a8556cbac6b6c00d3c9352ba9d56b2aabbbb2 /drivers | |
parent | f1ebbe4cd07d058f42174cc5b8c5efcf83de8ffa (diff) | |
download | lwn-2555906fd53e0a5239431d44fad695b420e94fdd.tar.gz lwn-2555906fd53e0a5239431d44fad695b420e94fdd.zip |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/fbdev/core/fbcon.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index d9abae2516d8..e8b4e8c119b5 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -512,8 +512,10 @@ static int search_fb_in_map(int idx) int i, retval = 0; for (i = first_fb_vc; i <= last_fb_vc; i++) { - if (con2fb_map[i] == idx) + if (con2fb_map[i] == idx) { retval = 1; + break; + } } return retval; } @@ -523,8 +525,10 @@ static int search_for_mapped_con(void) int i, retval = 0; for (i = first_fb_vc; i <= last_fb_vc; i++) { - if (con2fb_map[i] != -1) + if (con2fb_map[i] != -1) { retval = 1; + break; + } } return retval; } |