From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BFFF5C433EF for ; Tue, 18 Jan 2022 01:08:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E7C26837DD; Tue, 18 Jan 2022 02:08:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="slrcAFHW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E250837DE; Tue, 18 Jan 2022 02:08:45 +0100 (CET) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 45D56837D7 for ; Tue, 18 Jan 2022 02:08:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102f.google.com with SMTP id o14-20020a17090ac08e00b001b4b55792aeso759439pjs.3 for ; Mon, 17 Jan 2022 17:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=VHA+KbQ76fS/7+R35MfUPdwr3KXAPb1EYGz9qmCO8yY=; b=slrcAFHWRhJ9QqLhWl9YUzQdW/VvmaxdrJ30aofVAqRvKZDsiViHsqCsdjlNs+aJkO TXHVmCGXV04Qm5mZezwL8Y5VA4ArZKFgQ9ScNmlg4n/8yngw7KdinUC/y4ZBSsALkdey 5FTHUb8j12tEHoNgPYKrv51S5Y4Z/JxmtvrWpq1wyKxzfDrw0t/jH1UStxZDtqa7kxEz GtdXYTbCLAqspbdrSspK5gOotshfM4XGZ2tvfXFOr4e7MGZvbyY8TG6SwdBCxxxuRh5u RAqkNKnWpW1Qzx4FlrWUtavV96HfbBcjpzU1pVhnyYLIc/hy7q0im1+yJw+3AVRL1m6v tLKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=VHA+KbQ76fS/7+R35MfUPdwr3KXAPb1EYGz9qmCO8yY=; b=JrMzbAsvgXc0GnjUR45QxrXN11HcfCZln6+YZVY1xe2FEsFSgXWovwR2AahdAhsybg mBNpz1ZVEnvxy0WiEAtENLeOPtIPKxfN+GqIOl/ojyj6/tKho/On8NQuj5z+EzUIhWDV CJrzYtjsj/9GHJFsqgi7u7umpPpC7dnYIuBcPV/Xt0RGR5m4f/KOaXXoA81P1EGV7jT1 2Ma4BEAlE5VTSdr+ZimWkjLArkzrK0o+tq2PISCokwSS8JkDMtiNu6iONjBjFSRAlUnA rCJ2g9RED9fiDbPal6+hUZNqwYHJC2wAYEl0L8hBGaxIwKguMHA4zbddnipDZrQB57dB PKKA== X-Gm-Message-State: AOAM5326OAzdXZBN3lG4gHpwWdEUP2y4OSkQsXjfUgn3p4y5ABgh1ZBH DL240kgpP9r3weDxrTjrxd8HpQ== X-Google-Smtp-Source: ABdhPJxoduDXSpEe8VxcyDhfQZ2dmlvPL5Ml9iYInQlFhcCCOHjxvEFuKM4Jv22RiJUBgfIBizPAkA== X-Received: by 2002:a17:902:dac9:b0:14a:52d1:a266 with SMTP id q9-20020a170902dac900b0014a52d1a266mr24677527plx.161.1642468120005; Mon, 17 Jan 2022 17:08:40 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:bc1a:291e:ac91:be98]) by smtp.gmail.com with ESMTPSA id m1sm12771196pgb.13.2022.01.17.17.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 17:08:39 -0800 (PST) Date: Tue, 18 Jan 2022 10:08:36 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf Subject: Re: [PATCH] efidebug: avoid 'dfu_alt_info not defined' message Message-ID: <20220118010836.GA30001@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Alexander Graf References: <20220115011821.87588-1-heinrich.schuchardt@canonical.com> <20220117004523.GA7045@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Mon, Jan 17, 2022 at 01:33:51PM +0100, Heinrich Schuchardt wrote: > On 1/17/22 01:45, AKASHI Takahiro wrote: > > On Sat, Jan 15, 2022 at 02:18:21AM +0100, Heinrich Schuchardt wrote: > > > If variable dfu_alt_info is not defined duplicate messages are displayed. > > > > > > => efidebug boot dump > > > Scanning disk mmc2.blk... > > > Scanning disk mmc1.blk... > > > Scanning disk mmc0.blk... > > > Found 3 disks > > > No EFI system partition > > > "dfu_alt_info" env variable not defined! > > > Probably dfu_alt_info not defined > > > "dfu_alt_info" env variable not defined! > > > Probably dfu_alt_info not defined > > > > > > Remove the 'Probably dfu_alt_info not defined' message. > > > Instead write a warning if the variable contains no entities. > > > > > > Signed-off-by: Heinrich Schuchardt > > > --- > > > lib/efi_loader/efi_firmware.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > > > index a1b88dbfc2..519a47267c 100644 > > > --- a/lib/efi_loader/efi_firmware.c > > > +++ b/lib/efi_loader/efi_firmware.c > > > @@ -128,8 +128,11 @@ static efi_status_t efi_get_dfu_info( > > > size_t names_len, total_size; > > > int dfu_num, i; > > > u16 *name, *next; > > > + int ret; > > > - dfu_init_env_entities(NULL, NULL); > > > + ret = dfu_init_env_entities(NULL, NULL); > > > + if (ret) > > > + return EFI_SUCCESS; > > > > Do you want to return EFI_SUCCESS here? > > It is mandatory that "dfu_alt_info" be defined so that the current > > FMP drivers should work. > > So if the variable is not defined, I think, > > efi_firmware_[fit|raw]_get_image_info() should fail. > > Even if it returns EFI_SUCCESS, descriptor_count should be set to zero. > > This patch did not change the return value. It only removed superfluous > messages that I saw everytime I used the sandbox. The return value is the same, but > For dfu_num == 0 we are returning EFI_SUCCESS. If the number is 0 due to the > content of dfu_alt_info or due to its absence, should not make a difference > in the return code. Writing a message if dfu_alt_info exists but contains no > entity seems reasonable. With your patch, the value of "descriptor_count", as well as the other arguments, will remain uncertain even we see EFI_SUCCESS at return. Since dfu_init_env_entities() returns -EINVAL in case "dfu_alt_info" is not defined, efi_get_dfu_info(), hence efi_firmware_[fit|raw]_get_image_info(), returns immediately without setting any value to "descriptor_count". Have you ever tested your code? > If you think EFI_SUCCESS is not correct in both cases, please, send a > followup patch for review. NAK. We are discussing the issue against your patch. Why not do so in this thread? -Takahiro Akashi > Best regards > > Heinrich > > > > > -Takahiro Akashi > > > > > names_len = 0; > > > dfu_num = 0; > > > @@ -138,7 +141,7 @@ static efi_status_t efi_get_dfu_info( > > > dfu_num++; > > > } > > > if (!dfu_num) { > > > - log_warning("Probably dfu_alt_info not defined\n"); > > > + log_warning("No entities in dfu_alt_info\n"); > > > *image_info_size = 0; > > > dfu_free_entities(); > > > -- > > > 2.33.1 > > > >