diff options
| author | Marek Vasut <[email protected]> | 2022-09-19 21:19:23 +0200 |
|---|---|---|
| committer | Marek Vasut <[email protected]> | 2022-10-10 18:08:18 +0200 |
| commit | fcb670b794c9839c026757bf2d5cd564323ce199 (patch) | |
| tree | 15faa558f0d01a821d32ff8139fb3077eaf22d35 /common | |
| parent | 73e741b8ee46eba4e02a3bcc758dbd70540ed3c1 (diff) | |
usb: Add missing guard around env_get() in usb_hub
The env_get() might be undefined in case ENV_SUPPORT is disabled,
which may happen e.g. in SPL. Add missing ifdef guard around the
env_get() to prevent build failure.
Signed-off-by: Marek Vasut <[email protected]>
Tested-by: Fabio Estevam <[email protected]>
Diffstat (limited to 'common')
| -rw-r--r-- | common/usb_hub.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/usb_hub.c b/common/usb_hub.c index d73638950b9..95f1449b5cb 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -168,7 +168,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub) int i; struct usb_device *dev; unsigned pgood_delay = hub->desc.bPwrOn2PwrGood * 2; - const char *env; + const char __maybe_unused *env; dev = hub->pusb_dev; @@ -193,10 +193,12 @@ static void usb_hub_power_on(struct usb_hub_device *hub) * but allow this time to be increased via env variable as some * devices break the spec and require longer warm-up times */ +#if CONFIG_IS_ENABLED(ENV_SUPPORT) env = env_get("usb_pgood_delay"); if (env) pgood_delay = max(pgood_delay, (unsigned)simple_strtol(env, NULL, 0)); +#endif debug("pgood_delay=%dms\n", pgood_delay); /* |
