All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: Add missing guard around env_get() in usb_hub
@ 2022-09-19 19:19 Marek Vasut
  2022-09-19 23:42 ` Fabio Estevam
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2022-09-19 19:19 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Glass, Tom Rini

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 <marex@denx.de>
---
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
 common/usb_hub.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);
 
 	/*
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: Add missing guard around env_get() in usb_hub
  2022-09-19 19:19 [PATCH] usb: Add missing guard around env_get() in usb_hub Marek Vasut
@ 2022-09-19 23:42 ` Fabio Estevam
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2022-09-19 23:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Simon Glass, Tom Rini

Hi Marek,

On Mon, Sep 19, 2022 at 4:19 PM Marek Vasut <marex@denx.de> wrote:
>
> 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.

Yes, this fixes a build failure when adding imx8mm-evk SDP SPL support, thanks:

Tested-by: Fabio Estevam <festevam@denx.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-19 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 19:19 [PATCH] usb: Add missing guard around env_get() in usb_hub Marek Vasut
2022-09-19 23:42 ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.