usb: Replace empty define with do while
Subsystems (2)
PATCH 1/1 usb: Replace empty define with do while
It's dangerous to use empty code define. Furthermore it lead to the following warning:
"suggest braces around empty body in an « else » statement"
So let's replace emptyness by "do {} while(0)"
--- drivers/usb/host/ehci.h | 2 +- drivers/usb/host/fotg210.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci.h +1 -1
@@ -237,7 +237,7 @@ struct ehci_hcd { /* one per controller */struct ehci_stats stats;# define COUNT (x) ((x)++)#else -# define COUNT (x) +# define COUNT (x) do {} while (0)#endif /* debug files */
drivers/usb/host/fotg210.h +1 -1
@@ -179,7 +179,7 @@ struct fotg210_hcd { /* one per controller */struct fotg210_stats stats;# define COUNT (x) ((x)++)#else -# define COUNT (x) +# define COUNT (x) do {} while (0)#endif /* debug files */
Quoted 5 lines · Corentin Labbe
It's dangerous to use empty code define. Furthermore it lead to the following warning:
"suggest braces around empty body in an « else » statement"So let's replace emptyness by "do {} while(0)"
I also suggest renaming COUNT to something more
intelligible like INCR as the uses are all for
incrementing variables that may not exist.
Quoted 18 lines
drivers/usb/host/ehci.h +1
-1@@ -237,7 +237,7 @@ struct ehci_hcd { /* one per controller */struct ehci_stats stats;# define COUNT (x) ((x)++)#else -# define COUNT (x) +# define COUNT (x) do {} while (0)#endif /* debug files */ drivers/usb/host/fotg210.h +0
-0
drivers/usb/host/fotg210.h struct fotg210_hcd { /* one per controller */ · line 185
Quoted 8 lines
drivers/usb/host/fotg210.h +1
-1@@ -179,7 +179,7 @@ struct fotg210_hcd { /* one per controller */struct fotg210_stats stats;# define COUNT (x) ((x)++)#else -# define COUNT (x) +# define COUNT (x) do {} while (0)#endif /* debug files */
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html