net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend
Subsystems (3)
PATCH 1/1 net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend
Clang warns:
drivers/net/usb/aqc111.c:1326:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]
struct aqc111_wol_cfg wol_cfg = { 0 };
^
{}1 warning generated.
Add another set of braces to initialize the char subobjects as well.
--- drivers/net/usb/aqc111.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/aqc111.c +1 -1
@@ -1323,7 +1323,7 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) 1, 1, ®8);if (aqc111_data->wol_flags) { -struct aqc111_wol_cfg wol_cfg = {0 }; +struct aqc111_wol_cfg wol_cfg = { {0 } }; aqc111_data->phy_cfg |=AQ_WOL ;ether_addr_copy (wol_cfg.hw_addr, dev->net->dev_addr);
Signature · 1 line
2.20.0.rc1
David Miller
maintainerFrom: Nathan Chancellor <[email protected]>
Date: Wed, 28 Nov 2018 22:18:09 -0700
Quoted 7 lines
Clang warns:
drivers/net/usb/aqc111.c:1326:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]struct aqc111_wol_cfg wol_cfg = { 0 }; ^ {}
Quoted 6 lines
1 warning generated.
Add another set of braces to initialize the char subobjects as well.
Fixes e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")Signed-off-by Nathan Chancellor <[email protected]>
This will in turn make some versions of gcc warn.
Please just memset() this object, thanks.
Quoted 12 lines · David Miller
From: Nathan Chancellor <[email protected]>
Date: Wed, 28 Nov 2018 22:18:09 -0700Quoted 9 lines
Clang warns:
drivers/net/usb/aqc111.c:1326:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]struct aqc111_wol_cfg wol_cfg = { 0 }; ^ {}1 warning generated.
Quoted 8 lines
Quoted 4 lines
Add another set of braces to initialize the char subobjects as well.
Fixes e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")Signed-off-by Nathan Chancellor <[email protected]>This will in turn make some versions of gcc warn.
Please just
memset()this object, thanks.
I thought this was the form that all compilers seemed to agree on but sure, I will send a v2.
Thanks for the quick response,
Nathan
PATCH v2 1/1 net: usb: aqc111: Initialize wol_cfg with memset in aqc111_suspend
In reply to Nathan ChancellorClang warns:
drivers/net/usb/aqc111.c:1326:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]
struct aqc111_wol_cfg wol_cfg = { 0 };
^
{}1 warning generated.
Use memset to initialize the object to take compiler instrumentation out of the equation.
---
v1 -> v2:
* Use memset instead of braces.
drivers/net/usb/aqc111.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/aqc111.c +3 -1
@@ -1323,7 +1323,9 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) 1, 1, ®8);if (aqc111_data->wol_flags) { -struct aqc111_wol_cfg wol_cfg = {0 }; +struct aqc111_wol_cfg wol_cfg; + +memset (&wol_cfg,0 ,sizeof (struct aqc111_wol_cfg )); aqc111_data->phy_cfg |=AQ_WOL ;ether_addr_copy (wol_cfg.hw_addr, dev->net->dev_addr);
Signature · 1 line
2.20.0.rc1
Re: [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset in aqc111_suspend
From: Nathan Chancellor <[email protected]>
Date: Wed, 28 Nov 2018 23:01:05 -0700
Quoted 7 lines
Clang warns:
drivers/net/usb/aqc111.c:1326:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]struct aqc111_wol_cfg wol_cfg = { 0 }; ^ {}
Quoted 7 lines
1 warning generated.
Use memset to initialize the object to take compiler instrumentation out of the equation.
Fixes e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")Signed-off-by Nathan Chancellor <[email protected]>
Applied.