From patchwork Fri Apr 15 07:15:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 561946 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp115829map; Fri, 15 Apr 2022 00:18:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN+N62xgdiTBd4S5suf+csuysdQixPB+OHsCCh+fGqTQ3ySvol2JrMcmnV88K3c31KO/YC X-Received: by 2002:a17:907:6287:b0:6e1:6ac:c769 with SMTP id nd7-20020a170907628700b006e106acc769mr5310407ejc.388.1650007090506; Fri, 15 Apr 2022 00:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650007090; cv=none; d=google.com; s=arc-20160816; b=fQu97eZt2ohchw/fp78Ic2teqFOpqBG97CBoe6/bzyn5oRFGKAgUWvYGl/075gIUsQ UdpBzbxTVDC8EiNDbE2JghYWJbqLqrU9NpqE3G/fW60Xo3VeLpdzU5uOu5zx7yuh2Oli Qtb1wDQmcfPKv/np+YYGJpOJMJnOWvYQn67Ixhthrtd+fumxazvQm41DbCgCdJTM84yL kXT9KuJHFtxZSQ73RAJDcZHX/KkhJtoK5M3ZqXVgRyeoU3DLcMsLbvEz+rZkncat6cj+ +uAygF0yGy22Zr8taeDflbQCYW/odBweAy80PxUZ2+jUdifTlcEsTgLsffmpY6JiYJuF wblg== 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=Y8YmNVkjNu8Cx5kXjY7TqgcEUFRl0MxoAHahqoo7O8/bwjE2nTJ5ehHBHpQW+D7vv0 9breA2jwLn9uYCeRt3YhZgp+IXhrDHG++7gUsrcWBqfZkqPfOZtMt+PawZUwElPFCSO3 r+/czBzK0/cK+Yxb835CVcPnkVlb2046uhkuDoikgJ/3g6oNYJ9V7Au9I6CPTEMNUhVw NaVsXhanubOAJEBdu8ncN42yThgZc+DtKD56UHe/2Yq/hpx4j9ARrHw1NIvLt5ArV7Bi dpNmn+xGIUugEvZPUS262mxqw0z9/5sg+rWrmAaBnS7GZ6to0wzUfXMI9QHr6QNyubAU P2iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xv3CpU8y; 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 n25-20020a05640206d900b00418e57d9986si593018edy.42.2022.04.15.00.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:18:10 -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=xv3CpU8y; 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 D908883E30; Fri, 15 Apr 2022 09:16:52 +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="xv3CpU8y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED15183D9B; Fri, 15 Apr 2022 09:16:42 +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-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 B7A4283D8C for ; Fri, 15 Apr 2022 09:16:39 +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-pf1-x432.google.com with SMTP id s8so6693653pfk.12 for ; Fri, 15 Apr 2022 00:16:39 -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=xv3CpU8yn7+VwzBJt6JbZYXL5TwhUS473PIoTbgKaMAqUopKOVe/yb8frZ+iPxmHCn CwfM6YeV8QHEGNFnp9LpyNQrxCnuFiNGquHqq952vbTWkjm5xr/k9ICdJQAHp9hFQBVF nfMlqw9KuBo3nTwbk8ZKKSSnIFbbvoR8E777pxIxrxI51HaPvdXqmJJW247dahTZ/Qzt WEnFXeEyq2t8u3gQOZ66zLVgBJffY6w9RQKVz48eakAGwdex2Ilr5k5e9vzocnlS950q qVJv1Kru9k8FV+XA4ZiJ76KfUtjvHSf79NsKb9glwwDi+h3SM/JeWdhZElajeZG+b6el mWZw== 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=NToTUtbmUg7CGt2yTqfA6IIXxvFU6jN6y6q4XWBuWevz4Qc6oN1ElwfZulDXVsEFWP PaZIrcuSYIjzepfHpjSl63taIjqHGPmQAHdLwnIMDhqkRKYwEBKgQM1KVwcMFVacqzWZ 9Hl5GnbJeNB96B48nwtSuEOEU3p2ZGbZgVg6+HHC7j+qp+s72AXP8LxinJl+W2/ZR3QT LVHwi7znnJcADajYycctxinfElnrYVfABp9DI0cAj3cvbdg7Ep+nkpybmAJP4uaedvb2 4OhFEHeV1gwoIF14ZjsHsTDV20c9JOZRKjLBnWaPsV+bUyq6Vy6zc3ukaNm6mHALpCI+ uThw== X-Gm-Message-State: AOAM533LuFH8sG3qkoIp4PQwdnupOBkxWBfkfgnMbj5S5q6cdGn8NVy4 d4kF/RBaAbHJxlr/hdDtJ9Ctpg== X-Received: by 2002:a65:6951:0:b0:381:f10:ccaa with SMTP id w17-20020a656951000000b003810f10ccaamr5252905pgq.587.1650006998182; Fri, 15 Apr 2022 00:16:38 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:18f3:1e4:6c4:6ea3]) by smtp.gmail.com with ESMTPSA id p1-20020a17090a0e4100b001ce188720e5sm3566921pja.53.2022.04.15.00.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:16:37 -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 v4 10/12] efi_loader: disk: not delete BLK device for BLK(IF_TYPE_EFI_LOADER) devices Date: Fri, 15 Apr 2022 16:15:44 +0900 Message-Id: <20220415071546.122475-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220415071546.122475-1-takahiro.akashi@linaro.org> References: <20220415071546.122475-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);