[PATCH 1/1] usb: cdns3: fix static checker warning.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux