netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: mv88e6xxx: Add missing initialization in mv88e6xxx_set_port_state()
@ 2015-04-16 18:49 Geert Uytterhoeven
  2015-04-16 19:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2015-04-16 18:49 UTC (permalink / raw)
  To: David S. Miller, Guenter Roeck, Andrew Lunn
  Cc: netdev, linux-kernel, Geert Uytterhoeven

drivers/net/dsa/mv88e6xxx.c: In function ‘mv88e6xxx_set_port_state’:
drivers/net/dsa/mv88e6xxx.c:905: warning: ‘ret’ may be used uninitialized in this function

If oldstate == state, mv88e6xxx_set_port_state() will return an
uninitialized value. Pre-initialize ret to zero to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/dsa/mv88e6xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index f64186a5f63453f3..859a332fe5cd0251 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -902,7 +902,7 @@ static int _mv88e6xxx_flush_fid(struct dsa_switch *ds, int fid)
 static int mv88e6xxx_set_port_state(struct dsa_switch *ds, int port, u8 state)
 {
 	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-	int reg, ret;
+	int reg, ret = 0;
 	u8 oldstate;
 
 	mutex_lock(&ps->smi_mutex);
-- 
1.9.1

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

* Re: [PATCH] net: dsa: mv88e6xxx: Add missing initialization in mv88e6xxx_set_port_state()
  2015-04-16 18:49 [PATCH] net: dsa: mv88e6xxx: Add missing initialization in mv88e6xxx_set_port_state() Geert Uytterhoeven
@ 2015-04-16 19:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-16 19:34 UTC (permalink / raw)
  To: geert; +Cc: linux, andrew, netdev, linux-kernel

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Thu, 16 Apr 2015 20:49:14 +0200

> drivers/net/dsa/mv88e6xxx.c: In function ‘mv88e6xxx_set_port_state’:
> drivers/net/dsa/mv88e6xxx.c:905: warning: ‘ret’ may be used uninitialized in this function
> 
> If oldstate == state, mv88e6xxx_set_port_state() will return an
> uninitialized value. Pre-initialize ret to zero to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Indeed, applied, thanks Geert.

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

end of thread, other threads:[~2015-04-16 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16 18:49 [PATCH] net: dsa: mv88e6xxx: Add missing initialization in mv88e6xxx_set_port_state() Geert Uytterhoeven
2015-04-16 19:34 ` 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).