Skip to content

Commit 8e0a22e

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/gop: Slightly re-arrange logic of find_gop
Small cleanup to get rid of conout_found. Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent ecf5309 commit 8e0a22e

File tree

1 file changed

+13
-17
lines changed
  • drivers/firmware/efi/libstub

1 file changed

+13
-17
lines changed

drivers/firmware/efi/libstub/gop.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ find_gop(efi_guid_t *proto, unsigned long size, void **handles)
9999

100100
for_each_efi_handle(h, handles, size, i) {
101101
efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
102-
bool conout_found = false;
103102
void *dummy = NULL;
104103

105104
status = efi_bs_call(handle_protocol, h, proto, (void **)&gop);
@@ -111,25 +110,22 @@ find_gop(efi_guid_t *proto, unsigned long size, void **handles)
111110
if (info->pixel_format == PIXEL_BLT_ONLY)
112111
continue;
113112

113+
/*
114+
* Systems that use the UEFI Console Splitter may
115+
* provide multiple GOP devices, not all of which are
116+
* backed by real hardware. The workaround is to search
117+
* for a GOP implementing the ConOut protocol, and if
118+
* one isn't found, to just fall back to the first GOP.
119+
*
120+
* Once we've found a GOP supporting ConOut,
121+
* don't bother looking any further.
122+
*/
114123
status = efi_bs_call(handle_protocol, h, &conout_proto, &dummy);
115124
if (status == EFI_SUCCESS)
116-
conout_found = true;
117-
118-
if (!first_gop || conout_found) {
119-
/*
120-
* Systems that use the UEFI Console Splitter may
121-
* provide multiple GOP devices, not all of which are
122-
* backed by real hardware. The workaround is to search
123-
* for a GOP implementing the ConOut protocol, and if
124-
* one isn't found, to just fall back to the first GOP.
125-
*
126-
* Once we've found a GOP supporting ConOut,
127-
* don't bother looking any further.
128-
*/
125+
return gop;
126+
127+
if (!first_gop)
129128
first_gop = gop;
130-
if (conout_found)
131-
break;
132-
}
133129
}
134130

135131
return first_gop;

0 commit comments

Comments
 (0)