From patchwork Sat May 13 08:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780913 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=T4wipRHQ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK6t44Ckz20KG for ; Sat, 13 May 2023 18:48:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 88B2F847C2; Sat, 13 May 2023 10:48:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="T4wipRHQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 44A5F861A5; Sat, 13 May 2023 10:48:36 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1822484713 for ; Sat, 13 May 2023 10:48:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 77A3B41259; Sat, 13 May 2023 08:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967713; bh=zS+NUCzDQHJkJo1JEFiHVs4pDxcKwyGfTJSxHWiLI6c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T4wipRHQ9i71Emwf4wMNyckDKlZtKi6yAwz6gWj4k06KzguoYmxcyeEqgFpgxF1Ch KCb34+Yda3+F4qzdCwRVSahipUdQx+3RSroYCgQKvoEq2SimK17yUQ2Ydb6YmjvqIM Qvb/77vdBHtnsvqxzagOtqU2t2RIX3oX3ZvgwvKCPGN75nOnE3v61bijLboa669gpM x0hrcT3MYxFdlM0DGpNhXkjHzQLSSP3aszNyKa0r5ajq4BCBl0uswi/3JFX/O9KzP4 8XLPX2/grupqeX+sMcREB2oYML91LWpSdJO6DYzaSa0/sD+tsvVXraellX2/qr5TD1 Te5PVkJLO1KAA== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/6] efi_loader: avoid #ifdef in efi_dp_from_name() Date: Sat, 13 May 2023 10:48:15 +0200 Message-Id: <20230513084820.38625-2-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 According to our coding style guide #ifdef should be avoided. Use IS_ENABLED() instead. Sort string comparisons alphabetically. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 20ad948498..a6a6ef0d6c 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1079,8 +1079,7 @@ struct efi_device_path *efi_dp_from_uart(void) return buf; } -#ifdef CONFIG_NETDEVICES -struct efi_device_path *efi_dp_from_eth(void) +struct efi_device_path __maybe_unused *efi_dp_from_eth(void) { void *buf, *start; unsigned dpsize = 0; @@ -1099,7 +1098,6 @@ struct efi_device_path *efi_dp_from_eth(void) return start; } -#endif /* Construct a device-path for memory-mapped image */ struct efi_device_path *efi_dp_from_mem(uint32_t memory_type, @@ -1195,15 +1193,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, if (path && !file) return EFI_INVALID_PARAMETER; - if (!strcmp(dev, "Net")) { -#ifdef CONFIG_NETDEVICES - if (device) - *device = efi_dp_from_eth(); -#endif - } else if (!strcmp(dev, "Uart")) { - if (device) - *device = efi_dp_from_uart(); - } else if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) { + if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) { /* loadm command and semihosting */ efi_get_image_parameters(&image_addr, &image_size); @@ -1211,6 +1201,12 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, *device = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, (uintptr_t)image_addr, image_size); + } else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) { + if (device) + *device = efi_dp_from_eth(); + } else if (!strcmp(dev, "Uart")) { + if (device) + *device = efi_dp_from_uart(); } else { part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition, 1); From patchwork Sat May 13 08:48:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780914 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=gM+qP76b; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK790jXSz20KG for ; Sat, 13 May 2023 18:49:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 955E185DCE; Sat, 13 May 2023 10:48:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="gM+qP76b"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFCFD847C2; Sat, 13 May 2023 10:48:37 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B89A8847C2 for ; Sat, 13 May 2023 10:48:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 006CC4125E; Sat, 13 May 2023 08:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967714; bh=Q2kEH5xuUc3qZWKhUUHvCrc03XlStm0YQdc/uGmPjhk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gM+qP76bxybfdNX3MewYwt8mFCkzShK8uQd/2eJ2QOYwQG/x1YHStHFRXNjb8gCI7 seAr3Pie8zIZA4BcIRy4Xya55pj/b4NSguCJimam6R5FiXgKbW0O8qiaRLp5M+MMU8 D0T4fNmehxCHbcoLwtcmSlM6KEofaq37fmAqitzq5SJMYBJITjyUFT+FIXXgwXNI3M FSzQMBp+r36jJT5ukLNQR8xW21BvZrDNn7EtzyTTuIZrnjQHbda0unzNtjp40hkBQT ofNfMWqmdBa9mj0ES6o1ayRaqA1f/S7OIcNSGn7YBtgVTvjDpEhFNLzY9MO9S1sZzP rA2SHdjmOQ3+Q== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 2/6] efi_loader: duplicate code in efi_dp_from_name Date: Sat, 13 May 2023 10:48:16 +0200 Message-Id: <20230513084820.38625-3-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 efi_dp_from_name() has duplicate code to replace slash by backslash. path_to_uefi() called by efi_dp_from_file() already does this. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index a6a6ef0d6c..c4f0cc23a0 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1187,8 +1187,6 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, size_t image_size; void *image_addr; int part = 0; - char *filename; - char *s; if (path && !file) return EFI_INVALID_PARAMETER; @@ -1220,17 +1218,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, if (!path) return EFI_SUCCESS; - filename = calloc(1, strlen(path) + 1); - if (!filename) - return EFI_OUT_OF_RESOURCES; - - sprintf(filename, "%s", path); - /* DOS style file path: */ - s = filename; - while ((s = strchr(s, '/'))) - *s++ = '\\'; - *file = efi_dp_from_file(desc, part, filename); - free(filename); + *file = efi_dp_from_file(desc, part, path); if (!*file) return EFI_INVALID_PARAMETER; From patchwork Sat May 13 08:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780918 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=jaI09QKO; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK8C3wWBz20KG for ; Sat, 13 May 2023 18:50:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E556786394; Sat, 13 May 2023 10:48:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="jaI09QKO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E338084718; Sat, 13 May 2023 10:48:38 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 285E485DCE for ; Sat, 13 May 2023 10:48:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 96A0140019; Sat, 13 May 2023 08:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967714; bh=qbTaOmdVQv/be/cBRCFnDAptVFsUtyCe+ZcKF6Tn2xI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jaI09QKO8Xffll2aULc8Mfajr60HmDS2zdG2qRyTV2XKCyaLXP88r1pJPF666v0aT Zyvfjm/vqXXMqlfL6IxQm7/APj9sb+UjwKVTYNHtwlF+7KnUnLd5YA9RDgkOsBy+se mgJfmSW67rav5vm67t4qmPvr6afO3pxTAcfF2XV+WVeipeRJ4egKt+3nehjZUXadBK 8E3/GaYTU5ZphlKaLsnt8H2qcCYi0yJGpmbHhcII0dNu+7nqYkpZpDrT2ocqfcjVoF bIo+ASdPyqDC8Pc8ajoFDbEpGiswJbW9AIFrk5Nl7ZmCe3jh7Y2bidjYy/Zef2u0Ua lSpkezQKhTdAA== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 3/6] efi_loader: clean up efi_dp_from_file Date: Sat, 13 May 2023 10:48:17 +0200 Message-Id: <20230513084820.38625-4-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 * Improve variable name usage: Use pos instead of buf to indicate the current position in a buffer. * Avoid double assignment in a single code line. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index c4f0cc23a0..0f58082141 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1022,7 +1022,7 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, const char *path) { struct efi_device_path_file_path *fp; - void *buf, *start; + void *buf, *pos; size_t dpsize = 0, fpsize; if (desc) @@ -1035,26 +1035,28 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, dpsize += fpsize; - start = buf = efi_alloc(dpsize + sizeof(END)); + buf = efi_alloc(dpsize + sizeof(END)); if (!buf) return NULL; if (desc) - buf = dp_part_fill(buf, desc, part); + pos = dp_part_fill(buf, desc, part); + else + pos = buf; /* add file-path: */ if (*path) { - fp = buf; + fp = pos; fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH; fp->dp.length = (u16)fpsize; path_to_uefi(fp->str, path); - buf += fpsize; + pos += fpsize; } - *((struct efi_device_path *)buf) = END; + memcpy(pos, &END, sizeof(END)); - return start; + return buf; } struct efi_device_path *efi_dp_from_uart(void) From patchwork Sat May 13 08:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780915 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=hrT4kZC2; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK7R1Y5bz20KG for ; Sat, 13 May 2023 18:49:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 646DE8626D; Sat, 13 May 2023 10:48:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="hrT4kZC2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07A1885C96; Sat, 13 May 2023 10:48:38 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 97BB985FEF for ; Sat, 13 May 2023 10:48:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 05BC141259; Sat, 13 May 2023 08:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967715; bh=aTIGlL+YwtKnw6SdQpcwiV2J0n8xTo/k3FbkEhOcB2Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hrT4kZC27vTTyoVegh8BDoYE2TLbdtNW3RMkw39i+AkmimaRX/DniSCti4whIezkd +9tFboujSBCjtR3hHcH4VgtpEplqMb2+5rvoYAKUgKc4xQF2FekBNafenCC1cStInT e4v+K1ePZ/k5t/zhlck65c7bO806nBYddhGu/aLSLrFiQosmzC58lV3w7mcg4Zr+rX dbF2juUcjWTSTqx2GZglxQI27co+gHw4y+MLukZ8ksGgHcsP8A2MdzlAgC1YT9e+q/ IT1hRCxNexoVvcEq8ENKVEcJRPzcL41CjTsXDxNJgcJ3WpHQw7iweJNzJkOAbgGdw8 TR+llC1yXOGOg== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 4/6] efi_loader: error code efi_dp_from_name() Date: Sat, 13 May 2023 10:48:18 +0200 Message-Id: <20230513084820.38625-5-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 Use EFI_OUT_OF_RESOURCES if the device path cannot be constructed. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 0f58082141..1436244f99 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1223,7 +1223,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, *file = efi_dp_from_file(desc, part, path); if (!*file) - return EFI_INVALID_PARAMETER; + return EFI_OUT_OF_RESOURCES; return EFI_SUCCESS; } From patchwork Sat May 13 08:48:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780916 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=hykQVWTR; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK7j2Krpz20KG for ; Sat, 13 May 2023 18:49:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F1B58631D; Sat, 13 May 2023 10:48:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="hykQVWTR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2763D85FEF; Sat, 13 May 2023 10:48:38 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1623284702 for ; Sat, 13 May 2023 10:48:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 839634125E; Sat, 13 May 2023 08:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967715; bh=aZoOUTbGXv/WwV2TiqASPhLESom88WRDoluPf3RCGj8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hykQVWTRiOqQbxFBaVEngJiUrUQodqsGjCUMRsMJK3ei3A2GWoJzazxGoZZyxtfdG PB5H58OAQdc4z0hVNiSL5FPGqAp+mGYA0EmJdokc/uXdnVV9IEAThZLInSKMCWyHks A1OoYCA7krphZAVGHJGC/2XPKqU0FxdJ+V++NdEz4DZu4tDVS2jqpI9vYNBYPsbUJm sCjm5I8zzmL7PQoOCKGwe9XYt2fB0fz4409tIg2q6sW8cAGUC++myMI2c7wuIt8RmH Lah0KnlmGHuU4IoSABdCut+H7cZalZi0bnAeaCYBNm4Y6iK2/TW+gF9FrV5snR7w4k nHW91UHzMMbFg== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 5/6] efi_loader: simplify efi_dp_from_name() Date: Sat, 13 May 2023 10:48:19 +0200 Message-Id: <20230513084820.38625-6-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 Don't do the same check and assignment in multiple places. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 1436244f99..a9b0ea4015 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1185,6 +1185,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, struct efi_device_path **file) { struct blk_desc *desc = NULL; + struct efi_device_path *dp; struct disk_partition fs_partition; size_t image_size; void *image_addr; @@ -1197,25 +1198,22 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, /* loadm command and semihosting */ efi_get_image_parameters(&image_addr, &image_size); - if (device) - *device = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, - (uintptr_t)image_addr, - image_size); + dp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, + (uintptr_t)image_addr, image_size); } else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) { - if (device) - *device = efi_dp_from_eth(); + dp = efi_dp_from_eth(); } else if (!strcmp(dev, "Uart")) { - if (device) - *device = efi_dp_from_uart(); + dp = efi_dp_from_uart(); } else { part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition, 1); if (part < 0 || !desc) return EFI_INVALID_PARAMETER; - if (device) - *device = efi_dp_from_part(desc, part); + dp = efi_dp_from_part(desc, part); } + if (device) + *device = dp; if (!path) return EFI_SUCCESS; From patchwork Sat May 13 08:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1780917 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=WklfEES9; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QJK7y2t9Hz20KG for ; Sat, 13 May 2023 18:49:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E34A86368; Sat, 13 May 2023 10:48:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="WklfEES9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA93C85C96; Sat, 13 May 2023 10:48:38 +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,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 92B9784713 for ; Sat, 13 May 2023 10:48:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 0B10940019; Sat, 13 May 2023 08:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683967716; bh=7KVl/MPb61TKdr4uF7LjspWtGU+8JMJPLP2tOWGzj/g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WklfEES9XibPGqSb2t6ARNLaWdoHkQpLj+9CppjsYNgPL0oEQu099+JmNpUxLNM7m IPDjeWzylHk4DB/M2bJnaAFtDVXYNKolPmualQONl3wbgoAaetbH6IHgIIW2bITdvC JSAMZOOeiGCwRfA4f555LQ3AFa6rXUFDAnoNxgjA5FEkLdRiR2vteGiujrW+THDiNh Tn45pb11KX3gJKCZBwksWzYkjyUy9p3eXYv1cw4LX0EmtuRUkTh9WG8lm/2ShNC0am hkkapGCeWK8fxzQGhL8woB7dMRKDd3TMA/DycfleLPAGv4xGZGJRouVGn0V8AotvRk BQFdlq+MNJzOg== From: Heinrich Schuchardt To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 6/6] efi_loader: fix efi_dp_from_file() Date: Sat, 13 May 2023 10:48:20 +0200 Message-Id: <20230513084820.38625-7-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> References: <20230513084820.38625-1-heinrich.schuchardt@canonical.com> 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 * When called from efi_dp_from_name() we miss to append the filename for non-block devices. * expand_media_path() could be simplified by using efi_dp_from_file to prepend the device path of the boot device. This can be avoided by passing a device path to efi_dp_from_file() instead of a block device descriptor and a partition number. Signed-off-by: Heinrich Schuchardt --- cmd/bootefi.c | 2 +- include/efi_loader.h | 2 +- lib/efi_loader/efi_bootmgr.c | 13 ++++------- lib/efi_loader/efi_device_path.c | 39 +++++++++----------------------- 4 files changed, 18 insertions(+), 38 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 8aa15a64c8..5c0afec154 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -589,7 +589,7 @@ static efi_status_t bootefi_test_prepare if (!bootefi_device_path) return EFI_OUT_OF_RESOURCES; - bootefi_image_path = efi_dp_from_file(NULL, 0, path); + bootefi_image_path = efi_dp_from_file(NULL, path); if (!bootefi_image_path) { ret = EFI_OUT_OF_RESOURCES; goto failure; diff --git a/include/efi_loader.h b/include/efi_loader.h index b395eef9e7..38d7f66bab 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -810,7 +810,7 @@ bool efi_dp_is_multi_instance(const struct efi_device_path *dp); struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); /* Create a device node for a block device partition. */ struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part); -struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, +struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp, const char *path); struct efi_device_path *efi_dp_from_eth(void); struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 4b24b41047..7ac5f89f76 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -47,7 +47,7 @@ const efi_guid_t efi_guid_bootmenu_auto_generated = static struct efi_device_path *expand_media_path(struct efi_device_path *device_path) { - struct efi_device_path *dp, *rem, *full_path; + struct efi_device_path *rem, *full_path; efi_handle_t handle; if (!device_path) @@ -58,15 +58,12 @@ struct efi_device_path *expand_media_path(struct efi_device_path *device_path) * simple file system protocol, append a default file name to support * booting from removable media. */ - dp = device_path; - handle = efi_dp_find_obj(dp, &efi_simple_file_system_protocol_guid, - &rem); + handle = efi_dp_find_obj(device_path, + &efi_simple_file_system_protocol_guid, &rem); if (handle) { if (rem->type == DEVICE_PATH_TYPE_END) { - dp = efi_dp_from_file(NULL, 0, - "/EFI/BOOT/" BOOTEFI_NAME); - full_path = efi_dp_append(device_path, dp); - efi_free_pool(dp); + full_path = efi_dp_from_file(device_path, + "/EFI/BOOT/" BOOTEFI_NAME); } else { full_path = efi_dp_dup(device_path); } diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index a9b0ea4015..71923b1127 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1002,47 +1002,31 @@ static void path_to_uefi(void *uefi, const char *src) } /** - * efi_dp_from_file() - create device path for file + * efi_dp_from_file() - append file path node to device path. * - * The function creates a device path from the block descriptor @desc and the - * partition number @part and appends a device path node created describing the - * file path @path. - * - * If @desc is NULL, the device path will not contain nodes describing the - * partition. - * If @path is an empty string "", the device path will not contain a node - * for the file path. - * - * @desc: block device descriptor or NULL - * @part: partition number - * @path: file path on partition or "" + * @dp: device path or NULL + * @path: file path or NULL * Return: device path or NULL in case of an error */ -struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, - const char *path) +struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp, + const char *path) { struct efi_device_path_file_path *fp; void *buf, *pos; - size_t dpsize = 0, fpsize; - - if (desc) - dpsize = dp_part_size(desc, part); + size_t dpsize, fpsize; + dpsize = efi_dp_size(dp); fpsize = sizeof(struct efi_device_path) + 2 * (utf8_utf16_strlen(path) + 1); if (fpsize > U16_MAX) return NULL; - dpsize += fpsize; - - buf = efi_alloc(dpsize + sizeof(END)); + buf = efi_alloc(dpsize + fpsize + sizeof(END)); if (!buf) return NULL; - if (desc) - pos = dp_part_fill(buf, desc, part); - else - pos = buf; + memcpy(buf, dp, dpsize); + pos = buf + dpsize; /* add file-path: */ if (*path) { @@ -1218,8 +1202,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, if (!path) return EFI_SUCCESS; - *file = efi_dp_from_file(desc, part, path); - + *file = efi_dp_from_file(dp, path); if (!*file) return EFI_OUT_OF_RESOURCES;