aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorEmmanuel Vadot2016-10-19 10:19:47 -0500
committerTom Rini2016-10-24 07:04:43 -0500
commit5d81c6df320e40c741f474a54cc6df451e830143 (patch)
treee9a77ecf671dafe29ecf87d9422c011118dddc87 /api
parent0dbc9b591a56bc5a93455632de5e4d62c73e6ca5 (diff)
downloadu-boot-5d81c6df320e40c741f474a54cc6df451e830143.tar.gz
u-boot-5d81c6df320e40c741f474a54cc6df451e830143.tar.xz
u-boot-5d81c6df320e40c741f474a54cc6df451e830143.zip
api: storage: Avoid enumeration for non-configured subsystem
If a subsystem wasn't configured, avoid enumeration. Signed-off-by: Emmanuel Vadot <manu@bidouilliste.com>
Diffstat (limited to 'api')
-rw-r--r--api/api_storage.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/api/api_storage.c b/api/api_storage.c
index d425a9ad1d..b5aaba1091 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -41,7 +41,7 @@ struct stor_spec {
41 char *name; 41 char *name;
42}; 42};
43 43
44static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, }; 44static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, NULL }, };
45 45
46 46
47void dev_stor_init(void) 47void dev_stor_init(void)
@@ -105,6 +105,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
105 105
106 struct blk_desc *dd; 106 struct blk_desc *dd;
107 107
108 /* Wasn't configured for this type, return 0 directly */
109 if (specs[type].name == NULL)
110 return 0;
111
108 if (first) { 112 if (first) {
109 di->cookie = (void *)blk_get_dev(specs[type].name, 0); 113 di->cookie = (void *)blk_get_dev(specs[type].name, 0);
110 if (di->cookie == NULL) 114 if (di->cookie == NULL)