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: 1617679 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=xv3CpU8y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kfnjc4nXzz9sG0 for ; Fri, 15 Apr 2022 17:18:12 +1000 (AEST) 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-Google-Smtp-Source: ABdhPJz7f0MCOrCGUaJttSh6LQSZFWFn/iNCYteEw+jOr+wQeLjbtWnoj8JTwHiihOP0afW6KvKCjQ== 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);