Skip to contentSkip to conversation

usb: dwc3: trace: Refactor nested switch to make compiler happy

PATCH New Andy Shevchenko 1 participant 1 message Dec 5, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: trace: Refactor nested switch to make compiler happy

Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Felipe Balbi
Quoted 5 lines · Andy Shevchenko

The missed break statement in the outer switch makes the code fall through always and thus always same value will be printed.

Besides that, compiler warns about missed fall through marker:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

drivers/usb/dwc3/./trace.h: In function ‘trace_raw_output_dwc3_log_trb’:
drivers/usb/dwc3/./trace.h:246:4: warning: this statement may fall through [-Wimplicit-fallthrough=]

    switch (pcm) {
    ^~~~~~

easier to add "break" here, no? That would be the minimal fix.

No. Then you would need to add same default to the inner switch.

Ah, you meant that pcm would be never outside of the given cases. Yes, that's fine then, consider my patch as a bugreport.