Skip to content

Commit

Permalink
usb: cdns3: Error out if USB_DR_MODE_UNKNOWN in cdns3_core_init_role()
Browse files Browse the repository at this point in the history
USB_DR_MODE_UNKNOWN should be treated as error as it is done in
cdns3_drd_update_mode().

Fixes: 02ffc26 ("usb: cdns3: fix cdns3_core_init_role()")
Signed-off-by: Roger Quadros <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Roger Quadros authored and gregkh committed Oct 18, 2019
1 parent 7a6f22d commit 9794476
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/cdns3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
goto err;

switch (cdns->dr_mode) {
case USB_DR_MODE_UNKNOWN:
case USB_DR_MODE_OTG:
ret = cdns3_hw_role_switch(cdns);
if (ret)
Expand All @@ -182,6 +181,9 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
if (ret)
goto err;
break;
default:
ret = -EINVAL;
goto err;
}

return ret;
Expand Down

0 comments on commit 9794476

Please sign in to comment.