staging: greybus: Replace zero-length array by DECLARE_FLEX_ARRAY() helper
PATCH v2 1/1 staging: greybus: Replace zero-length array by DECLARE_FLEX_ARRAY() helper
The code currently uses C90 standard extension based zero length array struct which is now deprecated and the new C99 standard extension of flexible array declarations are to be used instead. Also, the macro DECLARE_FLEX_ARRAY() allows to use single flexible array member in a structure. Refer to these links [1], [2], and [3] for details.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://lore.kernel.org/lkml/YxKY6O2hmdwNh8r8@work
[3] https://lore.kernel.org/lkml/[email protected]/
Issue identified using Coccinelle flexible_array.cocci semantic patch.
---
Changes in v2:
Following improvements as suggested by Alex Elder <[email protected]>
- Include third reference URL in the commit message.
- Update 2nd reference URL
- Include Reviewed by tag
drivers/staging/greybus/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/usb.c +1 -1
@@ -27,7 +27,7 @@ struct gb_usb_hub_control_request { };struct gb_usb_hub_control_response { -u8 buf[0 ]; + DECLARE_FLEX_ARRAY(u8, buf); };struct gb_usb_device {
--
2.34.1