From patchwork Tue Jun 13 13:23:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 691981 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp417315wru; Tue, 13 Jun 2023 06:23:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6acs1JJl1ck5fgskU0QrlKSYYbzLMd8E+H289kpXXzIabunuD99PAJO9qtxo3Y5AVEcmDb X-Received: by 2002:a05:6a00:2488:b0:660:ec6d:56af with SMTP id c8-20020a056a00248800b00660ec6d56afmr16737088pfv.24.1686662605251; Tue, 13 Jun 2023 06:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686662605; cv=none; d=google.com; s=arc-20160816; b=dO+iJKvvQxq0VfVtIz021cl6dEU/X+snJjp8BodwzlHYDWexnHBBE3YlBsmNIw9dd+ YItVzCGxjR9CIbe7lRBTKb24VUexoVYE4QY5JrSD7Zk2QL7FzBkNm3jASnJ5TNv4eEJB rY/tYUtB0DoNlvqOhLEZsGK3TJD0secQ9KZYGEqqtkxX2GTH5MdOsQLO9xEBpQwmTSMC HcagthBJ+u6XJqaACoDIbHqgikvlzu6KVaj9263ZhJvUGwKE9TihSUX9NU+2h0wIAxmJ NUK+mWMAAVvJiutCfr+6khiF+V0MaF3MvshD9OmB2kB3DSekBHzYcvrCEnQZ3IHLo9dL Q7fg== 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=54Do8NQATp82mIxijRfBlbXtkfEKl/vEv0a9qNHhw14=; b=D7mf7ICDYg8Z+gGuLPDc93CDa4jkcFeurHQp9bD5ldZnXy1cxaEXG5A51LagMoVoMq dbi1ADHtc2zLOd4NdiIt1vGmR/weWSZFOrbZd1xgl8dXFS94nKbovuOkevk1Bjx5YuBo 6GKPhXItlGJa9SljCScCY21ZsoYtTN3iJni+IXtlSGBrSdA0s3j/9mrQWcmWDj/1aQJY Th2pGQN7A3Q+4kwuR/oRMFHg11bVGgc85wFdVfAW324/IVjQ8m8ZpNPtdjcYaSkemU6r q59gQUGgAE+6F1vCQnpJzSlgj45N4VDZiLikdyhkA4RNzcBP3oVMqYFLL9Ny+cDfibhl J4Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmiIV1Ve; 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 p4-20020aa79e84000000b006538b58db09si7917056pfq.284.2023.06.13.06.23.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 06:23:25 -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=pmiIV1Ve; 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 EF67F862E2; Tue, 13 Jun 2023 15:23:17 +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="pmiIV1Ve"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC864862E5; Tue, 13 Jun 2023 15:23:15 +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-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 6BFE58628C for ; Tue, 13 Jun 2023 15:23:13 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f8d2bfed53so3779235e9.1 for ; Tue, 13 Jun 2023 06:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686662593; x=1689254593; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=54Do8NQATp82mIxijRfBlbXtkfEKl/vEv0a9qNHhw14=; b=pmiIV1Ve/XUNg0KwOy09UYL7P7EYhBN4siQqQXoc7rMyG16fF4rjEgZtv1Dh+XdRqx 6HKFBytdVOGYFrByKc1afKSIFEnYhFEeZqwFA9a95lzgC1J+LqC54NCSBB4A9RXp/lMQ RvMdezK/kL0Q1w5HfmHZrnWcDuI6astCdymQ4UVEK+HZEg4FCL3rXAGGonkvm9w3CBIl Yxgd0K4Kjf+qURqJPKq7aRmItcXv5xpogp0P0gTIF+9h0JdF4GRX0QMD3ysK5Y/0C1Su 8E65HAt+Ze7JJ1vDKQVCe7+gKJdR9/l2jgfQjHyMvU0uqBzxGWJp1FdXsw6karI6dQ1w k1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686662593; x=1689254593; 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=54Do8NQATp82mIxijRfBlbXtkfEKl/vEv0a9qNHhw14=; b=ZcLEiCatr3FuAEq1KAet1nUn8Na/9wgl4yuYWSSyG7Zm7edbeh7ZcSscWyQy/p3FI3 NUG2V9IkbWs3k1YeExAlfhPhBHk57AgCsrUG8ukSXI06BHZdmJPNV0k4lGN7dHdkkKRV s2V06yVh+x6C0H77nfgZqN3f+r/XZi5jWjkMEv8Fz73wecPwwlGncbkTOxXySGEEZcZH /VMZzj59I0Q7p7fF+PijpkdkhgSI9y0p6ei7FLFdH8KDWR6uLnWcxB/bmiDDbaz7h1Mk qO8cIoLItfGtqasQhsZMhSZSMzbK75brvLCATGtjUBig9Udd0UpT2eJuZfdYgO/y2qdQ dq0Q== X-Gm-Message-State: AC+VfDwT3tqL9tiUc//u7qpcTgFFocQSK2Vbv86hBgMgiSJk4kWA2Zte 8/AjXjwsnzKWe9VUlF8HWDcrW+F9hQVt8sKKxVuMMA== X-Received: by 2002:a05:600c:3508:b0:3f8:651:4b37 with SMTP id h8-20020a05600c350800b003f806514b37mr10250870wmq.2.1686662592845; Tue, 13 Jun 2023 06:23:12 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id q25-20020a7bce99000000b003f17848673fsm14410930wmj.27.2023.06.13.06.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 06:23:12 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH] efi_selftests: fix controllers repeated selftesting Date: Tue, 13 Jun 2023 16:23:05 +0300 Message-Id: <20230613132306.83940-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 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 Running the controller selftest more than one times fails with => setenv efi_selftest 'controllers' && bootefi selftest Testing EFI API implementation Selected test: 'controllers' Setting up 'controllers' Setting up 'controllers' succeeded Executing 'controllers' Executing 'controllers' succeeded Summary: 0 failures => bootefi selftest Testing EFI API implementation Selected test: 'controllers' Setting up 'controllers' lib/efi_selftest/efi_selftest_controllers.c(280): ERROR: InstallProtocolInterface failed lib/efi_selftest/efi_selftest.c(89): ERROR: Setting up 'controllers' failed Summary: 1 failures There are multiple reason for this. We don't uninstall the binding interface from the controller handle and we don't reset the handle pointers either. So let's uninstall all the protocols properly and reset the handles to NULL on setup(). While at it add a forgotten check when uninstalling protocols from the handle_controller and make sure the number of child controllers is 0 Signed-off-by: Ilias Apalodimas --- lib/efi_selftest/efi_selftest_controllers.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_controllers.c b/lib/efi_selftest/efi_selftest_controllers.c index d2bbd1c4f65b..07a17ed866a9 100644 --- a/lib/efi_selftest/efi_selftest_controllers.c +++ b/lib/efi_selftest/efi_selftest_controllers.c @@ -271,6 +271,8 @@ static int setup(const efi_handle_t img_handle, efi_status_t ret; boottime = systable->boottime; + handle_controller = NULL; + handle_driver = NULL; /* Create controller handle */ ret = boottime->install_protocol_interface( @@ -402,8 +404,18 @@ static int execute(void) /* Check number of child controllers */ ret = count_child_controllers(handle_controller, &guid_controller, &count); - if (ret == EFI_SUCCESS) + if (ret == EFI_SUCCESS || count != 0) efi_st_error("Uninstall failed\n"); + + /* Uninstall binding protocol */ + ret = boottime->uninstall_protocol_interface(handle_driver, + &guid_driver_binding_protocol, + &binding_interface); + if (ret != EFI_SUCCESS) { + efi_st_error("Failed to uninstall protocols\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; }