From patchwork Tue Apr 19 01:05:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 563303 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp2861002map; Mon, 18 Apr 2022 18:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMYGZqs25WkDJff6qOh/fWVaUet7D7PLR0pyQNxBZWGb4i8nNJWOxvTDGIK03u0YzHnJxo X-Received: by 2002:a17:907:7242:b0:6da:b561:d523 with SMTP id ds2-20020a170907724200b006dab561d523mr11116420ejc.118.1650330453439; Mon, 18 Apr 2022 18:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650330453; cv=none; d=google.com; s=arc-20160816; b=zbY2HMEkG2BXrrETP3FvsSe7p9STpCGJQFYzceDWJTo/2NgyDETJvwi5HsoxFtAqmQ rIzxIPH8DLdl+wTroUvOSLxgYaZWbwzNfwkN2e5Guo7LEelmokq9zQtRDqnVVPvU933E 0eS+3xPzsik1zBjNrS7ltFvXZRFTmj3pb8zf6UL167Gstsc8WnLX+42LaC1jaWmG7YiE WQM+mtMxz3iMkJOJdNYtGE2kMYUJQf1xNVy5Y/hS0OOUqZidijyC1rlip11EO0lT4uBT /nvRbw8IiTf8I+jE6Njia7AUY+iI9Gf9vR9asA//9ZpagK5dRWPbdOJxVtCqDaN3u/hl 4D0w== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iM8IiiuHSbTPbKVfkhnxnKS9CR4E6GlTaqdcIdJsPes=; b=fRNhWNm/9b1qw29ANl4hkjQbFM592pA4dT4Sg13m38vtpMwG9bG5o8u3+T0Oh+Rp1A 3Vd29kVH848F15Yn1UpfhBxLO8qUyk7KIcQtZeOD9qLIqlmKZkXGHfqwRhRKwhBSUent l8ImFCjwwZpVmOhstkQ2Jeyi/CjU++MEVBFXelnfjeuhf6DPowIL9I82ct6r3tAEa/yr yDzwvt/tN3yxEcxCx7Hh7vy19L8qC8kfgySmvw39UrPW4UfJ8CZ79L/bjve9LTa2n4k0 BglBGK711lfjmw9piFq1ChZLezKZZDZ19zwxkeb1MEDWdXZBCRbN2/HM/lEkBSRTTbEI zcMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="lj1/6pyR"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id w15-20020a05640234cf00b00423fb5cb330si920096edc.187.2022.04.18.18.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 18:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="lj1/6pyR"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 7FB4083DB6; Tue, 19 Apr 2022 03:06:56 +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="lj1/6pyR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA68983D62; Tue, 19 Apr 2022 03:06:11 +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-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 E0A7983C8C for ; Tue, 19 Apr 2022 03:06:03 +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-pj1-x1030.google.com with SMTP id o5so14448998pjr.0 for ; Mon, 18 Apr 2022 18:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iM8IiiuHSbTPbKVfkhnxnKS9CR4E6GlTaqdcIdJsPes=; b=lj1/6pyRPvdn6kD0zhnxanqG/DhGgBmGTEeZPT6WHc4tHobe8FeroR3cJuOGHRzGsx IdmhgYfUKm10RsRonuKuBN/0tWAWIp91WYieo6OwEl/+DqBaJKwfrxGT6lOq26CAeIiT lTFqnAzwd4i37rG0akFHln2wPJzx8tDKMT+4DWg3lpmIPIR/A/fiCd/LLJTwEONOy83N 02r96uTWMKbMPsT9SFv5cltaw/gMRj9j6+FyIWfIBQd2LtEpm9JSpkrznbiOV+T9l0iK xWRcgBpRPhDqDEILGIx+4yG/jnNvOxbqLCRamGPtm/pEtuPzoY8mW4HiTVHlES8vaDRs /pTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iM8IiiuHSbTPbKVfkhnxnKS9CR4E6GlTaqdcIdJsPes=; b=5N5JAdKwjXYSCeOq/GManUEOYEV7+Ey/+57IWsiHnI/4JtANl7Qou6vs9Q3jrQ6LAj U7sSOiLY6jk6hmhSK14JdaZOsxBK4/KvkxezYLZ6umrjcg2VTbpTdbaPFgCTDLN2Ed+z 1T4dGnbRgpo7PnTnLi/VicY56wiD0hQdFJmliwZ4hozlTb4yDcj8eFtYbwL+8F82Gq5P nbHQjv4znpd+LXQyKi8PvE7czpJTNqcsblXpZXFJ4F0ZEOwxDIxeds7PmlI7GlH4Sgce 6zh11Zl6Wra8ysep0ccxcuBhAYgdQyusGzxU2TKMo5x5cCdl/NgWXYps8gggMoo+zsg2 I8YQ== X-Gm-Message-State: AOAM5325tKERvJWY03wxSQKPCnsuEa81FJAfcojQztvdM0WhwadiflAO 7X+/C64eHAVXNah8KtGn1mNKDA== X-Received: by 2002:a17:902:7296:b0:151:62b1:e2b0 with SMTP id d22-20020a170902729600b0015162b1e2b0mr12915881pll.165.1650330361904; Mon, 18 Apr 2022 18:06:01 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:5858:d3a6:5cad:ceeb]) by smtp.gmail.com with ESMTPSA id k137-20020a633d8f000000b0039800918b00sm14043756pga.77.2022.04.18.18.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 18:06:01 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v5 10/12] efi_loader: disk: not delete BLK device for BLK(IF_TYPE_EFI_LOADER) devices Date: Tue, 19 Apr 2022 10:05:15 +0900 Message-Id: <20220419010517.47175-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220419010517.47175-1-takahiro.akashi@linaro.org> References: <20220419010517.47175-1-takahiro.akashi@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean When we create an efi_disk device with an UEFI application using driver binding protocol, the 'efi_driver' framework tries to create a corresponding block device(UCLASS_BLK/IF_TYPE_EFI). This will lead to calling a PROBE callback, efi_disk_probe(). In this case, however, we don't need to create another "efi_disk" device as we already have this device instance. So we should avoid recursively invoke further processing in the callback function. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- lib/efi_loader/efi_disk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 940390ac8bcc..34bb662e9cc0 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -648,13 +648,17 @@ static int efi_disk_probe(void *ctx, struct event *event) static int efi_disk_delete_raw(struct udevice *dev) { efi_handle_t handle; + struct blk_desc *desc; struct efi_disk_obj *diskobj; if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) return -1; - diskobj = container_of(handle, struct efi_disk_obj, header); - efi_free_pool(diskobj->dp); + desc = dev_get_uclass_plat(dev); + if (desc->if_type != IF_TYPE_EFI_LOADER) { + diskobj = container_of(handle, struct efi_disk_obj, header); + efi_free_pool(diskobj->dp); + } efi_delete_handle(handle); dev_tag_del(dev, DM_TAG_EFI);