usb: mtu3: remove repeated setting of gadget state
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 24 Apr 2018 02:52:47 +0000 (10:52 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 15 May 2018 07:14:57 +0000 (10:14 +0300)
The usb_add_gadget_udc() will set the gadget state as
USB_STATE_NOTATTACHED, so we needn't set it again.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/mtu3/mtu3_gadget.c

index f05f10f5c171b5fcc30a3ff39cd6c342a49eb3b5..de0de015eaf002d7b13284cc64316078fbfbbbc9 100644 (file)
@@ -660,14 +660,10 @@ int mtu3_gadget_setup(struct mtu3 *mtu)
        mtu3_gadget_init_eps(mtu);
 
        ret = usb_add_gadget_udc(mtu->dev, &mtu->g);
-       if (ret) {
+       if (ret)
                dev_err(mtu->dev, "failed to register udc\n");
-               return ret;
-       }
 
-       usb_gadget_set_state(&mtu->g, USB_STATE_NOTATTACHED);
-
-       return 0;
+       return ret;
 }
 
 void mtu3_gadget_cleanup(struct mtu3 *mtu)