* [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend
@ 2018-11-29 5:18 Nathan Chancellor
2018-11-29 5:52 ` David Miller
2018-11-29 6:01 ` [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset " Nathan Chancellor
0 siblings, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2018-11-29 5:18 UTC (permalink / raw)
To: David S. Miller
Cc: Dmitry Bezrukov, Igor Russkikh, netdev, linux-kernel, Nathan Chancellor
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.
Fixes: e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/net/usb/aqc111.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index f69d566bd523..1c2db1191073 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -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);
--
2.20.0.rc1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend
2018-11-29 5:18 [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend Nathan Chancellor
@ 2018-11-29 5:52 ` David Miller
2018-11-29 5:54 ` Nathan Chancellor
2018-11-29 6:01 ` [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset " Nathan Chancellor
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2018-11-29 5:52 UTC (permalink / raw)
To: natechancellor; +Cc: dmitry.bezrukov, igor.russkikh, netdev, linux-kernel
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Wed, 28 Nov 2018 22:18:09 -0700
> 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.
>
> Fixes: e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
This will in turn make some versions of gcc warn.
Please just memset() this object, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend
2018-11-29 5:52 ` David Miller
@ 2018-11-29 5:54 ` Nathan Chancellor
0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2018-11-29 5:54 UTC (permalink / raw)
To: David Miller; +Cc: dmitry.bezrukov, igor.russkikh, netdev, linux-kernel
On Wed, Nov 28, 2018 at 09:52:41PM -0800, David Miller wrote:
> From: Nathan Chancellor <natechancellor@gmail.com>
> Date: Wed, 28 Nov 2018 22:18:09 -0700
>
> > 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.
> >
> > Fixes: e58ba4544c77 ("net: usb: aqc111: Add support for wake on LAN by MAGIC packet")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset in aqc111_suspend
2018-11-29 5:18 [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend Nathan Chancellor
2018-11-29 5:52 ` David Miller
@ 2018-11-29 6:01 ` Nathan Chancellor
2018-12-01 1:26 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2018-11-29 6:01 UTC (permalink / raw)
To: David S. Miller
Cc: Dmitry Bezrukov, Igor Russkikh, netdev, linux-kernel, Nathan Chancellor
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.
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 <natechancellor@gmail.com>
---
v1 -> v2:
* Use memset instead of braces.
drivers/net/usb/aqc111.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index f69d566bd523..57f1c94fca0b 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -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);
--
2.20.0.rc1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset in aqc111_suspend
2018-11-29 6:01 ` [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset " Nathan Chancellor
@ 2018-12-01 1:26 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-12-01 1:26 UTC (permalink / raw)
To: natechancellor; +Cc: dmitry.bezrukov, igor.russkikh, netdev, linux-kernel
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Wed, 28 Nov 2018 23:01:05 -0700
> 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.
>
> 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 <natechancellor@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-01 1:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 5:18 [PATCH] net: usb: aqc111: Properly initialize wol_cfg in aqc111_suspend Nathan Chancellor
2018-11-29 5:52 ` David Miller
2018-11-29 5:54 ` Nathan Chancellor
2018-11-29 6:01 ` [PATCH v2] net: usb: aqc111: Initialize wol_cfg with memset " Nathan Chancellor
2018-12-01 1:26 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).