usb: cdns3: fix static checker warning.

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.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>
This commit is contained in:
Frank Li 2021-03-10 10:01:25 -06:00 коммит произвёл Peter Chen
Родитель ef32e0513a
Коммит 575dd7ece6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4859298150D671BB
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -527,7 +527,7 @@ int cdns_resume(struct cdns *cdns, u8 set_active)
struct device *dev = cdns->dev; struct device *dev = cdns->dev;
enum usb_role real_role; enum usb_role real_role;
bool role_changed = false; bool role_changed = false;
int ret; int ret = 0;
if (cdns_power_is_lost(cdns)) { if (cdns_power_is_lost(cdns)) {
if (cdns->role_sw) { if (cdns->role_sw) {