netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes
@ 2017-04-05 18:19 Florian Fainelli
  2017-04-05 18:19 ` [PATCH net-next 1/2] net: dsa: loop: Fix uninitialized pvid variable Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Florian Fainelli @ 2017-04-05 18:19 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, dan.carpenter, Florian Fainelli

Thanks to Dan's static checker, a bunch of small issues were found in the code.

Florian Fainelli (2):
  net: dsa: loop: Fix uninitialized pvid variable
  net: dsa: loop: Initialize err in dsa_loop_vlan_dump

 drivers/net/dsa/dsa_loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] net: dsa: loop: Fix uninitialized pvid variable
  2017-04-05 18:19 [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes Florian Fainelli
@ 2017-04-05 18:19 ` Florian Fainelli
  2017-04-05 18:19 ` [PATCH net-next 2/2] net: dsa: loop: Initialize err in dsa_loop_vlan_dump Florian Fainelli
  2017-04-06 20:34 ` [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2017-04-05 18:19 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, dan.carpenter, Florian Fainelli

Dan's static analyzer reported the following:

	drivers/net/dsa/dsa_loop.c:181 dsa_loop_port_vlan_del()
	error: XXX uninitialized symbol 'pvid'.

we were missing the assignment of pvid to ps->vid, so add that.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/dsa_loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index bc5acc15edbf..ee55a902fa66 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -164,7 +164,7 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
 	struct dsa_loop_priv *ps = ds->priv;
 	struct mii_bus *bus = ps->bus;
 	struct dsa_loop_vlan *vl;
-	u16 vid, pvid;
+	u16 vid, pvid = ps->pvid;
 
 	dev_dbg(ds->dev, "%s\n", __func__);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: dsa: loop: Initialize err in dsa_loop_vlan_dump
  2017-04-05 18:19 [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes Florian Fainelli
  2017-04-05 18:19 ` [PATCH net-next 1/2] net: dsa: loop: Fix uninitialized pvid variable Florian Fainelli
@ 2017-04-05 18:19 ` Florian Fainelli
  2017-04-06 20:34 ` [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2017-04-05 18:19 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, dan.carpenter, Florian Fainelli

Dan's static checker reported the following:

	drivers/net/dsa/dsa_loop.c:223 dsa_loop_port_vlan_dump()
	error: uninitialized symbol 'err'.

which could happen if we do hit the continue statement for each iteration of
the loop. Initialize err to 0 here.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/dsa_loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index ee55a902fa66..f0fc4de4fc9a 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -194,7 +194,7 @@ static int dsa_loop_port_vlan_dump(struct dsa_switch *ds, int port,
 	struct mii_bus *bus = ps->bus;
 	struct dsa_loop_vlan *vl;
 	u16 vid, vid_start = 0;
-	int err;
+	int err = 0;
 
 	dev_dbg(ds->dev, "%s\n", __func__);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes
  2017-04-05 18:19 [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes Florian Fainelli
  2017-04-05 18:19 ` [PATCH net-next 1/2] net: dsa: loop: Fix uninitialized pvid variable Florian Fainelli
  2017-04-05 18:19 ` [PATCH net-next 2/2] net: dsa: loop: Initialize err in dsa_loop_vlan_dump Florian Fainelli
@ 2017-04-06 20:34 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-06 20:34 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, dan.carpenter

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed,  5 Apr 2017 11:19:29 -0700

> Thanks to Dan's static checker, a bunch of small issues were found in the code.

Series applied, thanks Florian.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-06 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-05 18:19 [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes Florian Fainelli
2017-04-05 18:19 ` [PATCH net-next 1/2] net: dsa: loop: Fix uninitialized pvid variable Florian Fainelli
2017-04-05 18:19 ` [PATCH net-next 2/2] net: dsa: loop: Initialize err in dsa_loop_vlan_dump Florian Fainelli
2017-04-06 20:34 ` [PATCH net-next 0/2] net: dsa: Mock-up driver couple fixes 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).