Re: [PATCH 11/14] efi/gop: Allow specifying mode number on command line
From: Arvind Sankar
Date: Fri Mar 20 2020 - 13:51:12 EST
On Fri, Mar 20, 2020 at 05:36:04PM +0300, Dan Carpenter wrote:
> Hi Arvind,
>
> Thank you for the patch! Perhaps something to improve:
>
> url: https://github.com/0day-ci/linux/commits/Arvind-Sankar/efi-gop-Refactoring-mode-setting-feature/20200320-044605
> base: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> New smatch warnings:
> drivers/firmware/efi/libstub/gop.c:113 set_mode() error: uninitialized symbol 'new_mode'.
>
> # https://github.com/0day-ci/linux/commit/af85e496c9f577df9743784171b1cda94220dd8f
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout af85e496c9f577df9743784171b1cda94220dd8f
> vim +/info +85 drivers/firmware/efi/libstub/gop.c
>
> af85e496c9f577 Arvind Sankar 2020-03-19 97 static void set_mode(efi_graphics_output_protocol_t *gop)
> af85e496c9f577 Arvind Sankar 2020-03-19 98 {
> af85e496c9f577 Arvind Sankar 2020-03-19 99 efi_graphics_output_protocol_mode_t *mode;
> af85e496c9f577 Arvind Sankar 2020-03-19 100 u32 cur_mode, new_mode;
> af85e496c9f577 Arvind Sankar 2020-03-19 101
> af85e496c9f577 Arvind Sankar 2020-03-19 102 switch (cmdline.option) {
> af85e496c9f577 Arvind Sankar 2020-03-19 103 case EFI_CMDLINE_NONE:
> af85e496c9f577 Arvind Sankar 2020-03-19 104 return;
> af85e496c9f577 Arvind Sankar 2020-03-19 105 case EFI_CMDLINE_MODE_NUM:
> af85e496c9f577 Arvind Sankar 2020-03-19 106 new_mode = choose_mode_modenum(gop);
> af85e496c9f577 Arvind Sankar 2020-03-19 107 break;
>
> No default case?
Yeah, it's an enum with the only two values covered by the switch cases,
so it's really a bogus warning. I posted a v2 with a default case
instead anyway to silence it.
>
> af85e496c9f577 Arvind Sankar 2020-03-19 108 }
> af85e496c9f577 Arvind Sankar 2020-03-19 109
> af85e496c9f577 Arvind Sankar 2020-03-19 110 mode = efi_table_attr(gop, mode);
> af85e496c9f577 Arvind Sankar 2020-03-19 111 cur_mode = efi_table_attr(mode, mode);
> af85e496c9f577 Arvind Sankar 2020-03-19 112
> af85e496c9f577 Arvind Sankar 2020-03-19 @113 if (new_mode == cur_mode)
> af85e496c9f577 Arvind Sankar 2020-03-19 114 return;
> af85e496c9f577 Arvind Sankar 2020-03-19 115
> af85e496c9f577 Arvind Sankar 2020-03-19 116 if (efi_call_proto(gop, set_mode, new_mode) != EFI_SUCCESS)
> af85e496c9f577 Arvind Sankar 2020-03-19 117 efi_printk("Failed to set requested mode\n");
> af85e496c9f577 Arvind Sankar 2020-03-19 118 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx