From: Heinrich Schuchardt Date: Sun, 30 Sep 2018 16:57:35 +0200 Subject: [U-Boot] [PATCH] efi_loader: Fix warning in efi_load_image() In-Reply-To: <1538318295-12850-1-git-send-email-trini@konsulko.com> References: <1538318295-12850-1-git-send-email-trini@konsulko.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 09/30/2018 04:38 PM, Tom Rini wrote: > As observed with clang: > lib/efi_loader/efi_boottime.c:1624:7: warning: variable 'info' > is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] > if (ret != EFI_SUCCESS) > ^~~~~~~~~~~~~~~~~~ > lib/efi_loader/efi_boottime.c:1653:7: note: uninitialized use > occurs here > free(info); > ^~~~ > lib/efi_loader/efi_boottime.c:1624:3: note: remove the 'if' if > its condition is always false > if (ret != EFI_SUCCESS) > ^~~~~~~~~~~~~~~~~~~~~~~ > lib/efi_loader/efi_boottime.c:1602:31: note: initialize the > variable 'info' to silence this warning > struct efi_loaded_image *info; > ^ > = NULL > > Rather than change how we unwind the function it makes the most sense to > initialize info to NULL so that we can continue to pass it to free(). > > Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") > Cc: Heinrich Schuchardt > Cc: Alexander Graf > Signed-off-by: Tom Rini Reviewed-by: Heinrich Schuchardt