Skip to contentSkip to conversation

usb: core: devices: drop unreachable code in usb_dump_endpoint_descriptor()

PATCH Superseded Sergey Shtylyov 2 participants 4 messages Feb 8, 2022 – Feb 9, 2022 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: core: devices: drop unreachable code in usb_dump_endpoint_descriptor()

The *switch* statement in usb_dump_endpoint_descriptor() does handle all possible endpoint types expilictly, so the *defaut* label is unreachable.

Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.

---
This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

 drivers/usb/core/devices.c |    2 --
 1 file changed, 2 deletions(-)
drivers/usb/core/devices.c +0 -2
Index: usb/drivers/usb/core/devices.c
===================================================================
@@ -168,8 +168,6 @@ static char *usb_dump_endpoint_descripto
 	case USB_ENDPOINT_XFER_INT:
 		type = "Int.";
 		break;
-	default:	/* "can't happen" */
-		return start;
 	}
 
 	interval = usb_decode_interval(desc, speed);
#1 lore raw
Quoted 2 lines · Sergey Shtylyov

The *switch* statement in usb_dump_endpoint_descriptor() does handle all possible endpoint types expilictly, so the *defaut* label is unreachable.

It's *default*. :-) Please fix when/if merging!

Quoted 5 lines

Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.

[...]

MBR, Sergey

#2 lore raw
Quoted 4 lines · Sergey Shtylyov
Quoted 2 lines

The *switch* statement in usb_dump_endpoint_descriptor() does handle all possible endpoint types expilictly, so the *defaut* label is unreachable.

It's *default*. :-) Please fix when/if merging!

Oh, and it's expilicitly! :-/

Quoted 6 lines
Quoted 4 lines

Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.

[...]

MBR, Sergey

#3 lore raw
In reply to Sergey Shtylyov
Quoted 6 lines · Sergey Shtylyov
Quoted 2 lines · Sergey Shtylyov

The *switch* statement in usb_dump_endpoint_descriptor() does handle all possible endpoint types expilictly, so the *defaut* label is unreachable.

It's *default*. :-) Please fix when/if merging!

I can not easily change changelog texts when applying patches as the tools suck the patch in from the public archive, sorry.

Please resend.