usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET
authorDerald D. Woods <woods.technical@gmail.com>
Tue, 28 May 2019 02:22:00 +0000 (21:22 -0500)
committerTom Rini <trini@konsulko.com>
Sat, 13 Jul 2019 15:11:27 +0000 (11:11 -0400)
This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]
  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o
[...]

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
drivers/usb/musb-new/omap2430.c

index 32743aa72c55f28e1022bc1b4151b6c42acd8d04..cca1653f1e274ad7730fd9e19f7efc61f8323e89 100644 (file)
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
        struct musb_host_data *host = dev_get_priv(dev);
+#else
+       struct musb *musbp;
 #endif
        struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
        struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
        struct omap_musb_board_data *otg_board_data;
-       int ret;
+       int ret = 0;
        void *base = dev_read_addr_ptr(dev);
 
        priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
        ret = musb_lowlevel_init(host);
 #else
-       ret = musb_register(&platdata->plat,
+       musbp = musb_register(&platdata->plat,
                          (struct device *)otg_board_data,
                          platdata->base);
+       if (IS_ERR_OR_NULL(musbp))
+               return -EINVAL;
 #endif
        return ret;
 }