From patchwork Wed Oct 19 15:19:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Vadot X-Patchwork-Id: 684197 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3szbPK1l5Rz9tkc for ; Thu, 20 Oct 2016 02:25:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=bidouilliste.com header.i=@bidouilliste.com header.b=c4XEqhTV; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B1439A75BC; Wed, 19 Oct 2016 17:25:51 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vI-_P3RbVII6; Wed, 19 Oct 2016 17:25:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0896A755F; Wed, 19 Oct 2016 17:24:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9B5B8A7593 for ; Wed, 19 Oct 2016 17:20:48 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3gRiAjqxQTXe for ; Wed, 19 Oct 2016 17:20:20 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by theia.denx.de (Postfix) with ESMTPS id 1F3CBA755F for ; Wed, 19 Oct 2016 17:20:06 +0200 (CEST) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 72cc3126 for ; Wed, 19 Oct 2016 17:20:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=from :to:cc:subject:date:message-id; s=mail; bh=JZCROkjYoVlGi7vtxKATO wu/ULs=; b=c4XEqhTVZ/MW8kMNtDcsLGuFuBbsru4+I5K0gp3YR5lFeQhF63rh2 gEusund0LOtmTBEe+UPAHi3NRcu7DqX34oP+ykgTYazf4B2e3o/XmYoc5zT9zS2W ACDYzxd7tOK3drgUG6jIbwfmGwmJsQhylgOdCHN3hY5+kGPvfF76DI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=from:to :cc:subject:date:message-id; q=dns; s=mail; b=rfLqRbVxB3jI6z5fFj b6EdzR1IezTHwirUnVBD7rV3G4s2agXg/2w9aitu06DOyIRLdj9IAdAU9HlVIplI L+grXgEMz2eNOf1J0MqcqPMNUmDkvDVYumAYN9IMs9nTNAJjokr0RWh0JoPUpOIF HPFDbfdtQXANTBMPDkSoHbgb8= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id b7de3a13 TLS version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO for ; Wed, 19 Oct 2016 17:20:04 +0200 (CEST) Received: from elbarto (uid 1001) (envelope-from manu@bidouilliste.com) id 386110 by knuckles.blih.net (DragonFly Mail Agent v0.11); Wed, 19 Oct 2016 17:20:03 +0200 From: Emmanuel Vadot To: sjg@chromium.org, bmeng.cn@gmail.com, swarren@nvidia.com Date: Wed, 19 Oct 2016 17:19:47 +0200 Message-Id: <20161019151947.5191-1-manu@bidouilliste.com> X-Mailer: git-send-email 2.9.2 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] api: storage: Avoid enumeration for non-configured subsystem X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If a subsystem wasn't configured, avoid enumeration. Signed-off-by: Emmanuel Vadot --- api/api_storage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/api_storage.c b/api/api_storage.c index d425a9a..b5aaba1 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -41,7 +41,7 @@ struct stor_spec { char *name; }; -static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, }; +static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, NULL }, }; void dev_stor_init(void) @@ -105,6 +105,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) struct blk_desc *dd; + /* Wasn't configured for this type, return 0 directly */ + if (specs[type].name == NULL) + return 0; + if (first) { di->cookie = (void *)blk_get_dev(specs[type].name, 0); if (di->cookie == NULL)