From patchwork Mon Nov 5 09:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 150153 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2352481ljp; Mon, 5 Nov 2018 01:05:09 -0800 (PST) X-Google-Smtp-Source: AJdET5fbF31fBCvg5neV3Rqhq/RQI/QXo4pN+R3N4BrYrhvA1lzO3OMGNqAMvQA0ZQMXCjMWT4DR X-Received: by 2002:a17:906:12d3:: with SMTP id l19-v6mr9253977ejb.74.1541408709589; Mon, 05 Nov 2018 01:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541408709; cv=none; d=google.com; s=arc-20160816; b=hXfWNvqdU6QAu36W7hiK7eKrGvbxu9iAsJkyhv4I+l0cS9LBgIFOA6uea0GTO6hJdC 4mD2w3r1XYmIwvrJA8LHusVwe5YkUGr8/awAru1bCoJlxCBdTMAgo960Zm5+kl/OX9D5 hE8GcoXVhhNIiZkVm9zfFPq8kCuW89E5mX5xEN01vJM4LeKXoB7ZFmAh3JWOv6ZGgW95 TCtMziidC4fyQy9a1BPw8wTgQN4KP09Wzo47QdRK8moX/l4006pV0IGITkhrFJAb+Ive Lx3+v3MNv93AUvZ4zxmhq2sjthYgnheg1yHrdnRY545N9xa/IfwY7hS/Sfaza/x6qebv yQRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=WX3SmRPJ+SAvaCdwFbisTRYkevCT5VmWQG4aXoTQrBA=; b=IV3ILxgk4qwV1RA+a1VWjvokYunzuFYEg4+0ay/rnUyDkswzQ1eEhsFlEUGQ2BcroX aPq4wM+TD2iMkWuXV/IWFSzju71LNQf6jSe/+21sVhR+/e56rTGPoetv/fd9Cg3ti+Wh I/664ykyxmybNxtm2Z8NS9mEHY8bV5DSPq6NEDrqrfayhpEBqyV3alJQ+bSJm442en/o lRXuKpF2qU6CiyaicI3V6qIQxhfSR/xuWsICP8LiFevoV0rwhyDwOA6lDxw0oIvJN3Tb EdIExkuQbiY08+kQF7HgF9qHilx3QMNKO2VXrHzz5+SY2rQ0G6faPU5T8Nhu4PjNSFAl Iuig== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Cdl6S9W3; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u15-v6si6273311eds.450.2018.11.05.01.05.09; Mon, 05 Nov 2018 01:05:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Cdl6S9W3; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 2F507C22204; Mon, 5 Nov 2018 09:04:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 30723C2221A; Mon, 5 Nov 2018 09:04:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 55F87C22203; Mon, 5 Nov 2018 09:04:41 +0000 (UTC) Received: from mail-yb1-f196.google.com (mail-yb1-f196.google.com [209.85.219.196]) by lists.denx.de (Postfix) with ESMTPS id 01BCEC2220F for ; Mon, 5 Nov 2018 09:04:36 +0000 (UTC) Received: by mail-yb1-f196.google.com with SMTP id t13-v6so3469240ybb.8 for ; Mon, 05 Nov 2018 01:04:35 -0800 (PST) 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=RzoK5KV4imuacZlz2P/nz+AyGNQoWGbwxtWpUN+CwHw=; b=Cdl6S9W3WyPRigdiN439z+JFu6Eh5VkIFsBiDZnUzgDJQre3ANIZDKTag4cccOS6cp +0a1ONwb9JxWryc9OsrKP3FEpNEPzsR1Ovvs61p5ZvJQ8FO49VU7J4BZ5LkFf6tRH7XS UlDDTp0MmsZQQwT1dY47Zud7U7/E0nz1i3eqg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RzoK5KV4imuacZlz2P/nz+AyGNQoWGbwxtWpUN+CwHw=; b=SHp+/7pjpZSFwUaUBHCNqlGGqVdHQ/C2AE5tcFnvoLK2mKjiHCoiFalw9dCJtVoSZq nBBrPkAbK4h1IU/nr5QfVKNDsxOYx0uxjRN8tIbMAC0xcF1TkeqKqSP62FGMJ3fFI2Uu 8zI443Ns/l9j2wLyoPYVAvyO/VXi7mz7qkGt798entapymEkOKNmLZrV2sTX2mYcKQbA 4wnOagT1zZBSsvFMM6yUm4BB5BmoUr+d8EKuBT024MuGw129VzOCVMCWqLfoPwqAzlN+ aPZ7/0uG+Fcnpbk7xVPxSjX3rdrVALxCZntcJ8AigCfpW+lbVZmGKPPjIKsgzpcu46PV igig== X-Gm-Message-State: AGRZ1gJk6G9jD5LwKZxAjIGjDGwJSSsjPFgcaW3ouihWQOZxNts6A+vQ HgZyrgaAy0yya9KVfTLNRWmaUg== X-Received: by 2002:a25:4f89:: with SMTP id d131-v6mr19956349ybb.379.1541408674849; Mon, 05 Nov 2018 01:04:34 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id c74-v6sm3555143ywc.90.2018.11.05.01.04.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 01:04:34 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Mon, 5 Nov 2018 18:06:40 +0900 Message-Id: <20181105090653.7409-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181105090653.7409-1-takahiro.akashi@linaro.org> References: <20181105090653.7409-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 01/14] efi_loader: allow device == NULL in efi_dp_from_name() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" This is a preparatory patch for use in efi_serialize_load_option() as a load option's file_path should have both a device path and a file path. Signed-off-by: AKASHI Takahiro --- lib/efi_loader/efi_device_path.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index cdf7c7be8c5c..d94982314a3e 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -955,7 +955,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, char filename[32] = { 0 }; /* dp->str is u16[32] long */ char *s; - if (!device || (path && !file)) + if (path && !file) return EFI_INVALID_PARAMETER; is_net = !strcmp(dev, "Net"); @@ -965,10 +965,12 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, if (part < 0) return EFI_INVALID_PARAMETER; - *device = efi_dp_from_part(desc, part); + if (device) + *device = efi_dp_from_part(desc, part); } else { #ifdef CONFIG_NET - *device = efi_dp_from_eth(); + if (device) + *device = efi_dp_from_eth(); #endif } @@ -985,7 +987,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, s = filename; while ((s = strchr(s, '/'))) *s++ = '\\'; - *file = efi_dp_from_file(NULL, 0, filename); + *file = efi_dp_from_file(((!is_net && device) ? desc : NULL), + part, filename); return EFI_SUCCESS; }