aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/musb-new/musb_uboot.c
diff options
context:
space:
mode:
authorJagan Teki2018-07-20 12:43:56 +0530
committerJagan Teki2018-08-23 17:31:24 +0530
commit8b8d59f323d7fbd589ecb32b408841b675ca53f7 (patch)
treedc78ea6e5360a3bbd74f90cc260f78828bd2efdd /drivers/usb/musb-new/musb_uboot.c
parentb71d9e8b3805305ea4116733f515061710ad7081 (diff)
usb: musb-new: Fix improper musb host pointer
When MUSB is operating in peripheral mode, probe registering musb core using musb_register which intern return int value for validation. so there is no scope to preserve struct musb pointer but the same can be used in .remove musb_stop. So fix this by return musb_register with struct musb pointer. Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Purna Chandra Mandal <purna.mandal@microchip.com> Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino Tested-by: Jagan Teki <jagan@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/usb/musb-new/musb_uboot.c')
-rw-r--r--drivers/usb/musb-new/musb_uboot.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
index 2b04fbd046e..2bf918eab46 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -419,8 +419,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
}
#endif /* CONFIG_USB_MUSB_GADGET */
-int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
- void *ctl_regs)
+struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
+ void *ctl_regs)
{
struct musb **musbp;
@@ -436,14 +436,14 @@ int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
break;
#endif
default:
- return -EINVAL;
+ return ERR_PTR(-EINVAL);
}
*musbp = musb_init_controller(plat, (struct device *)bdata, ctl_regs);
- if (!*musbp) {
+ if (IS_ERR(*musbp)) {
printf("Failed to init the controller\n");
- return -EIO;
+ return ERR_CAST(*musbp);
}
- return 0;
+ return *musbp;
}