From patchwork Mon Jul 3 06:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 698628 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1589152wrs; Sun, 2 Jul 2023 23:09:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CWThSVUUY2S1Qeu/X8ZPygoo+PIIV/tJNjn5nF+raEhOi6ovWT/DZs9pnEzefagMw4s3p X-Received: by 2002:a05:600c:2310:b0:3fa:95d2:5498 with SMTP id 16-20020a05600c231000b003fa95d25498mr7538754wmo.22.1688364582848; Sun, 02 Jul 2023 23:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688364582; cv=none; d=google.com; s=arc-20160816; b=oZM5iZ5Ua1o5H24kNm53h8KH20h2BdRfkO9PS2YTnco+PzCb/kpm5ENUu2oVPKe2It 1bPJZHx1/LE7YU1m1iuyUCWLLASF0Osa6U6YAG1FPTVQbIvorUy7NxEEiC/jM93NIEem +IaPWQWI14FF1CitwWVgwdlTf0ePZPoYbRsj2Cox9TsD0U9aqbI/ajHX6EL6wBV+wIJE ebzfq6OZsnatfRVEnJqNUlrOSPnXuZvN5CapJztqQbPvPFmxZxCPC0wrexJL0BZHvsRL XunT7ANw7rnkgQM0e80nGb9BX2RPlj2U4zLTfoaW9QfcIFDM0aMCLA0IEXmcFuYQsyar BC/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=WIf2YDnw9ZGMknjJmzoKgoVmmGotPLRb+cwD3z0HWZA=; fh=gpdYxxDSkjksq0SPDzmCSI7ZyVgvPCj8hEVKlwnL0mk=; b=EzM6ZdHv9gaNdNncit+ssg51Pdv/y/q3TSlDXFnCakaSQsUOlaaYWAFceXKOT05huZ m5VLY+OvVvut71Yv+06w/iOo3VbcHAK6J3FsDcRN0rSHxia9BZJ5cW7LmxYMY+dvJpMU UX8wB/3kIi8/KzkvxoHzrB/vlZPWjDThKLl4eu3eHwf7we6K0hG99GC6G93QXXw2RtXh yxzbL8LX9rhrYMq2hwT6vkBVQPq1j9xtQHlH+4milQeJkm//i+AWhdHJhPj/w5d0VdaJ DRJXqQqc5hdOBOJgASZqovX5vOjfdgQOZSF2EnjBK8ffg1IV+T1LJH2c/WiSh1Ynkho8 DZiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jf19i0PH; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id b14-20020a05600c4e0e00b003fbd42ace28si1866310wmq.60.2023.07.02.23.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 23:09:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jf19i0PH; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBC5286346; Mon, 3 Jul 2023 08:09:40 +0200 (CEST) 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="jf19i0PH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CFC88631F; Mon, 3 Jul 2023 08:09:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 196E4865D6 for ; Mon, 3 Jul 2023 08:09:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b80ba9326bso32347935ad.1 for ; Sun, 02 Jul 2023 23:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688364560; x=1690956560; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WIf2YDnw9ZGMknjJmzoKgoVmmGotPLRb+cwD3z0HWZA=; b=jf19i0PHTPlH8DT2oHBuwAgmB03PAy2XleWos8t4gEu0eiKFUknrNYB5qPuyCdIUDt R4J8XJLF9an2jcFJLIKbBaCtLHVJOwLws9iQ7FLcpiHbwBMGb80WlRNc2gwBe3Hz9QP2 QG8U5piFH2JquSwRuCo9fn8Sr1q4cRngeZcxh1MoWfnI1JItQE6fUChiDQIwsEisWmBv HF0/fqcapRZm7cKhKQvh0sr24GaMfnvUGEre727bbp3uF6lThVi+qEV26ZeDA/+aDVf9 Ha1RQVXvfo/IpzGA7LWeMDNyqZdfRxTHmdU33wc2xkrNwfeltrG7YHKeIUZ5G+Sguje5 2D7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688364560; x=1690956560; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WIf2YDnw9ZGMknjJmzoKgoVmmGotPLRb+cwD3z0HWZA=; b=Q0Y1fuRoQLya511DrHqJWsUo3KQVAMXm2XRroZFvVrNkIxUQ+ZSqDorDXLHNd5kwWR XaDlXsK5xdBs9mNKjQ0+4IdeSUT+1MAWQrrNcRrL+VjbxW08yh5BlFfg1JZ6lOf+8Ss8 JkbkamYbfNGuoiWKKBquWsDayncABuO0BKLQnbdoKH38e6OnGvhgsHmjUCu5hTNpjqdX cwOAykafskGINzdvOAJtoivex36KKTlfBDjf3bAYZCxBTOQZUOtHUU46sc6c6o/lWF3J 7/CXKB2dQ9jx5CVq1qPzGXblbTzC3izvdsDk8zeN4iMVm4qRnAh2evdd24kdCP7s8K5K ncMA== X-Gm-Message-State: ABy/qLYTQ/vPkO1BPUGhGFcehFOQ7PZzhWUXmNEMk1sbqb84CwTUx5LC 3wDliiFoodj9ku+oeQOmHuFdpQMCof6MwtWe4hc= X-Received: by 2002:a17:902:eccb:b0:1b8:6981:49f9 with SMTP id a11-20020a170902eccb00b001b8698149f9mr12100771plh.23.1688364560168; Sun, 02 Jul 2023 23:09:20 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c24500b001ac5896e96esm7306694plg.207.2023.07.02.23.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 23:09:19 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , AKASHI Takahiro , Masahisa Kojima Subject: [PATCH v2] efi_driver: fix duplicate efiblk#0 issue Date: Mon, 3 Jul 2023 15:08:45 +0900 Message-Id: <20230703060845.311114-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The devnum value of the blk_desc structure starts from 0, current efi_bl_create_block_device() function creates two "efiblk#0" devices for the cases that blk_find_max_devnum() returns -ENODEV and blk_find_max_devnum() returns 0(one device found in this case). This commit uses blk_next_free_devnum() instead of blk_find_max_devnum(). Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt --- Changes in v2: - uses blk_next_free_devnum() instead of blk_find_max_devnum() lib/efi_driver/efi_block_device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index add00eeebb..e3abd90275 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -124,10 +124,8 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) struct efi_block_io *io = interface; struct efi_blk_plat *plat; - devnum = blk_find_max_devnum(UCLASS_EFI_LOADER); - if (devnum == -ENODEV) - devnum = 0; - else if (devnum < 0) + devnum = blk_next_free_devnum(UCLASS_EFI_LOADER); + if (devnum < 0) return EFI_OUT_OF_RESOURCES; name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */