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 ADB15EB64DC for ; Mon, 3 Jul 2023 04:32:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0BDEC865C1; Mon, 3 Jul 2023 06:32:38 +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="gF+VH1wr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDC71865D6; Mon, 3 Jul 2023 06:32:35 +0200 (CEST) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 8F99D865BC for ; Mon, 3 Jul 2023 06:32:33 +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=takahiro.akashi@linaro.org Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-77dcff76e35so57882739f.1 for ; Sun, 02 Jul 2023 21:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688358752; x=1690950752; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=2yR6wgdSBFEswxP9mit6oQWKvqjD31JH9ZNkZJ8XxnA=; b=gF+VH1wr6jcwoKmRZ2cT4vtG8Xj5mP4v9SBvy4MLY+65T3H8TmTfkiytzxTQWoJq1b yLqRG+MhXcp0gO6Qato4ZzKbgCr1ptajNqQQeBdT6p/xpZ6xPH0ry3QsvosI017H035y s4KNouqHV9RwI1jpBG0MT47pBp0qp18sbUuGO5vQke/8HutbgmkIL9YZ+IkdJ9JdG0mS fRHq6KIldpWKvOLa7fmDDyeoSONms4sFky+X4MBuf06nIaFrC4KdmlA093PunFUJDACE Ze06o4nJN8PcFFNMzN7PzO+VJ26SElhoC79idFdMrEaNsCe+K4U6Bofad767lfmoIhBe bFUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688358752; x=1690950752; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2yR6wgdSBFEswxP9mit6oQWKvqjD31JH9ZNkZJ8XxnA=; b=jBBCBSbq9q4mVaVkbZyaXQUlShgjmpir3ZO6zsWFFdr4rQsVuNVEdU87d0nj/l+bL1 B7VbXTcZINIPXwfHxC63mliDpFFQK8lrCkocfklCd9qMiOrsN5VYy1WQfga+ujd5pqEC BOLSl/1r8mFZ3wVgh9ffFsJ7yKjMrdVbOPprX5fwHnR2D/sdJiN6v8k45Bjg5JhRhIWf PNhid0WQYwtgO9+OGOchhBMn2NtMJtWWBbcjhXSOgDKh8i2LJ0nByTCKDagbZKw07V4z vlRoYFLmFTj6UVRTwDbfHxmHXyFd6V9+SZsd2q6QNBJJs8BgQhoYnojXmEoyUORsL1wk W91A== X-Gm-Message-State: ABy/qLbGLqdLAz6YBzhParD/KDIszCfpyfl4JCPQ9uO9b4TqYGBMx/H0 9SUu6ul4SHs42QmO6kQalWTykA== X-Google-Smtp-Source: APBJJlH49nPEtvmgavycSEQdhjN6IbR5l4u2DTvKXfHIeaBxgEhHUVf17XAVN9BI+SNcuDO7mfLC6w== X-Received: by 2002:a92:c14e:0:b0:345:bdc2:eb42 with SMTP id b14-20020a92c14e000000b00345bdc2eb42mr7693224ilh.3.1688358752053; Sun, 02 Jul 2023 21:32:32 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:b349:4abf:f4cb:7486]) by smtp.gmail.com with ESMTPSA id 29-20020a17090a195d00b00263cfc9c065sm404962pjh.30.2023.07.02.21.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 21:32:31 -0700 (PDT) Date: Mon, 3 Jul 2023 13:32:28 +0900 From: AKASHI Takahiro To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas Subject: Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue Message-ID: Mail-Followup-To: AKASHI Takahiro , Masahisa Kojima , u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas References: <20230703024718.309452-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703024718.309452-1-masahisa.kojima@linaro.org> 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 On Mon, Jul 03, 2023 at 11:47:18AM +0900, Masahisa Kojima wrote: > 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). > > The devnum value for the "efiblk" name needs to be incremented. > > Signed-off-by: Masahisa Kojima > --- > lib/efi_driver/efi_block_device.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c > index add00eeebb..e37bfe6e80 100644 > --- a/lib/efi_driver/efi_block_device.c > +++ b/lib/efi_driver/efi_block_device.c > @@ -129,6 +129,8 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) > devnum = 0; > else if (devnum < 0) > return EFI_OUT_OF_RESOURCES; > + else > + devnum++; /* device found, note that devnum starts from 0 */ So we can use blk_next_free_devnum() instead. -Takahiro Akashi > name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */ > if (!name) > -- > 2.34.1 >