netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jackie Liu <liu.yun@linux.dev>
To: kabel@kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, liu.yun@linux.dev
Subject: [PATCH] net: dsa: mv88e6xxx: fix uninit-value err in mv88e6393x_serdes_power
Date: Mon,  6 Dec 2021 18:13:52 +0800	[thread overview]
Message-ID: <20211206101352.2713117-1-liu.yun@linux.dev> (raw)

From: Jackie Liu <liuyun01@kylinos.cn>

'err' is not initialized. If the value of cmode is not in the switch case,
it will cause a logic error and return early.

Fixes: 7527d66260ac ("net: dsa: mv88e6xxx: Save power by disabling SerDes trasmitter and receiver")
Reported-by: kernel-bot <kernel-robot@kylinos.cn>
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 drivers/net/dsa/mv88e6xxx/serdes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
index 55273013bfb5..33727439724a 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -1507,7 +1507,7 @@ int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
 			    bool on)
 {
 	u8 cmode = chip->ports[port].cmode;
-	int err;
+	int err = 0;
 
 	if (port != 0 && port != 9 && port != 10)
 		return -EOPNOTSUPP;
-- 
2.25.1


             reply	other threads:[~2021-12-06 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 10:13 Jackie Liu [this message]
2021-12-06 13:45 ` [PATCH] net: dsa: mv88e6xxx: fix uninit-value err in mv88e6393x_serdes_power Andrew Lunn
2021-12-06 18:50   ` Marek Behún

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211206101352.2713117-1-liu.yun@linux.dev \
    --to=liu.yun@linux.dev \
    --cc=davem@davemloft.net \
    --cc=kabel@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).