linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Li <lznuaa@gmail.com>
To: peter.chen@kernel.org, pawell@cadence.com, a-govindraju@ti.com,
	linux-imx@nxp.com, linux-usb@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, lznuaa@gmail.com,
	dan.carpenter@oracle.com
Subject: [PATCH 1/1] usb: cdns3: fix static checker warning.
Date: Wed, 10 Mar 2021 10:01:25 -0600	[thread overview]
Message-ID: <20210310160125.810157-1-Frank.Li@nxp.com> (raw)

The patch c450e48eb570: "usb: cdns3: add power lost support for
system resume" from Feb 18, 2021, leads to the following static
checker warning:

        drivers/usb/cdns3/core.c:551 cdns_resume()
        error: uninitialized symbol 'ret'.

drivers/usb/cdns3/core.c
544
545     if (!role_changed) {
546            if (cdns->role == USB_ROLE_HOST)
547                  ret = cdns_drd_host_on(cdns);
548     else if (cdns->role == USB_ROLE_DEVICE)
549            ret = cdns_drd_gadget_on(cdns);

"ret" is uninitialized at else branch.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/usb/cdns3/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index 5d486c8a9d99..bb739d88179f 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -527,7 +527,7 @@ int cdns_resume(struct cdns *cdns, u8 set_active)
 	struct device *dev = cdns->dev;
 	enum usb_role real_role;
 	bool role_changed = false;
-	int ret;
+	int ret = 0;
 
 	if (cdns_power_is_lost(cdns)) {
 		if (cdns->role_sw) {
-- 
2.25.1


             reply	other threads:[~2021-03-10 16:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 16:01 Frank Li [this message]
2021-03-13 13:55 ` [PATCH 1/1] usb: cdns3: fix static checker warning Peter Chen

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=20210310160125.810157-1-Frank.Li@nxp.com \
    --to=lznuaa@gmail.com \
    --cc=a-govindraju@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=peter.chen@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).