From patchwork Sun Sep 30 14:38:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 976901 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=konsulko.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42NShN0bmVz9s4s for ; Mon, 1 Oct 2018 00:38:27 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A19B9C21DED; Sun, 30 Sep 2018 14:38:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8ACBEC21C57; Sun, 30 Sep 2018 14:38:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D340EC21C57; Sun, 30 Sep 2018 14:38:20 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) by lists.denx.de (Postfix) with ESMTPS id 511D0C21C38 for ; Sun, 30 Sep 2018 14:38:20 +0000 (UTC) Received: by mail-yw1-f67.google.com with SMTP id v1-v6so4495826ywv.6 for ; Sun, 30 Sep 2018 07:38:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ueOmeICw1VxndLdOMzDnY/oWm/5+ZeQ2+H78VG7hgbw=; b=syU9ayXAfh2yeLYKmg8gn2QIzLiK2UDhI9G6pHQUWMURHu0JaJrvOsXPOogTNqsV90 QLvEwHdcW/l5aWFY4DoqfJHvDnqwfvzvivCETBipnDmO4MCZNVODUAtJklG1TCeuCYDh CEtPuZ1asmfDJoBzLkoqcWfzq+8U2vF7yXJW2GRfq7Ah6q3Jp1Rb/tg0fOwgYPX3KgfR al64cSz+v1s8Gs5T4TGwFvdVuKxFRJb3KuImXbHjjJ7b2Yk2y0MCzpBd9LsZ/KWcVjRy arxW9YRTVtedqaDDoLeI7Jz4zTgATkeyp7ZxibVOpvEbDbssRWFpWRdpspQa7vtS6e9J k2sQ== X-Gm-Message-State: ABuFfogBMe4irh5Q1vUX9twW+wgnpMzYyDiEj4pM1kdMkSH9YV8QZ1/N TpWr6s6y5fFEclhTkxNeNt06DKw= X-Google-Smtp-Source: ACcGV60gQlKGTvcuxZA11pXc1q+oh9NtMXc2ouz9thkkm69voxFuQohYaPmSHcM3MqPVQGfivA1FVQ== X-Received: by 2002:a81:6783:: with SMTP id b125-v6mr3638665ywc.284.1538318299018; Sun, 30 Sep 2018 07:38:19 -0700 (PDT) Received: from localhost.localdomain (m9c2c36d0.tmodns.net. [208.54.44.156]) by smtp.gmail.com with ESMTPSA id b185-v6sm4251703ywf.12.2018.09.30.07.38.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Sep 2018 07:38:18 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Sun, 30 Sep 2018 10:38:15 -0400 Message-Id: <1538318295-12850-1-git-send-email-trini@konsulko.com> X-Mailer: git-send-email 2.7.4 Cc: Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH] efi_loader: Fix warning in efi_load_image() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- lib/efi_loader/efi_boottime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 97eb19cd14d2..ddf857ff267d 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1599,7 +1599,7 @@ static efi_status_t EFIAPI efi_load_image(bool boot_policy, efi_uintn_t source_size, efi_handle_t *image_handle) { - struct efi_loaded_image *info; + struct efi_loaded_image *info = NULL; struct efi_loaded_image_obj **image_obj = (struct efi_loaded_image_obj **)image_handle; efi_status_t ret;