diff options
author | Marek Vasut <marex@denx.de> | 2022-09-19 21:19:23 +0200 |
---|---|---|
committer | Joao Paulo Goncalves <joao.goncalves@toradex.com> | 2023-09-04 16:51:54 -0300 |
commit | be4bc9c5fb5b9bb7bc54b56aeac993ff242a8c16 (patch) | |
tree | 7afa03604adc4840de96a019619a9b5f4658aaed | |
parent | 3d561d02b546f583059e51ab230e386ddde6f426 (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.
Upstream-Status: Backport[fcb670b794c9839c026757bf2d5cd564323ce199]
Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Fabio Estevam <festevam@denx.de>
-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 990993aa2f..f231d711d8 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -166,7 +166,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; @@ -191,10 +191,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); /* |