diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-04-01 08:57:33 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-04-28 11:30:17 -0600 |
commit | 42175a70d1e85bf0e7949b3e27633fac0aa8d4b1 (patch) | |
tree | 3b37ce50cc97f97e31f2f289193a4119acdef9ba /drivers | |
parent | 159d6bf720a663b22f291dfbba337392a771d59a (diff) | |
download | u-boot-42175a70d1e85bf0e7949b3e27633fac0aa8d4b1.zip u-boot-42175a70d1e85bf0e7949b3e27633fac0aa8d4b1.tar.gz u-boot-42175a70d1e85bf0e7949b3e27633fac0aa8d4b1.tar.bz2 |
sandbox: fix sandbox_hub_submit_control_msg()
Avoid incorrect fall through:
A USB_RT_HUB request should not be treated as USB_RT_PORT.
Simplify the coding:
Avoid duplicate debug() statements.
This fixes all -Wimplicit-fallthrough warnings.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/emul/sandbox_hub.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/usb/emul/sandbox_hub.c b/drivers/usb/emul/sandbox_hub.c index 041ec37..084cc16 100644 --- a/drivers/usb/emul/sandbox_hub.c +++ b/drivers/usb/emul/sandbox_hub.c @@ -220,13 +220,9 @@ static int sandbox_hub_submit_control_msg(struct udevice *bus, udev->status = 0; udev->act_len = sizeof(*hubsts); return 0; + } } - default: - debug("%s: rx ctl requesttype=%x, request=%x\n", - __func__, setup->requesttype, - setup->request); - break; - } + break; case USB_RT_PORT | USB_DIR_IN: switch (setup->request) { case USB_REQ_GET_STATUS: { @@ -239,13 +235,12 @@ static int sandbox_hub_submit_control_msg(struct udevice *bus, udev->status = 0; udev->act_len = sizeof(*portsts); return 0; + } } - } - default: - debug("%s: rx ctl requesttype=%x, request=%x\n", - __func__, setup->requesttype, setup->request); break; } + debug("%s: rx ctl requesttype=%x, request=%x\n", + __func__, setup->requesttype, setup->request); } else if (pipe == usb_sndctrlpipe(udev, 0)) { switch (setup->requesttype) { case USB_RT_PORT: @@ -263,7 +258,7 @@ static int sandbox_hub_submit_control_msg(struct udevice *bus, debug(" ** Invalid feature\n"); } return ret; - } + } case USB_REQ_CLEAR_FEATURE: { int port; @@ -279,18 +274,11 @@ static int sandbox_hub_submit_control_msg(struct udevice *bus, } udev->status = 0; return 0; + } } - default: - debug("%s: tx ctl requesttype=%x, request=%x\n", - __func__, setup->requesttype, - setup->request); - break; - } - default: - debug("%s: tx ctl requesttype=%x, request=%x\n", - __func__, setup->requesttype, setup->request); - break; } + debug("%s: tx ctl requesttype=%x, request=%x\n", + __func__, setup->requesttype, setup->request); } debug("pipe=%lx\n", pipe); |