usb: squash lines for immediate return
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 6 Sep 2016 13:17:35 +0000 (22:17 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 23 Sep 2016 21:53:48 +0000 (17:53 -0400)
This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
common/usb.c
common/usb_kbd.c
common/usb_storage.c
drivers/usb/host/xhci-fsl.c

index b3ba487890ae81ff21b6efc4f141814308914c5d..15e1e4c64e485dd8fb27ddb0b8e97459cff61f5b 100644 (file)
@@ -557,12 +557,10 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
 static int usb_get_descriptor(struct usb_device *dev, unsigned char type,
                        unsigned char index, void *buf, int size)
 {
-       int res;
-       res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                       USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
-                       (type << 8) + index, 0,
-                       buf, size, USB_CNTL_TIMEOUT);
-       return res;
+       return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+                              USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
+                              (type << 8) + index, 0, buf, size,
+                              USB_CNTL_TIMEOUT);
 }
 
 /**********************************************************************
@@ -612,14 +610,10 @@ int usb_get_configuration_no(struct usb_device *dev, int cfgno,
  */
 static int usb_set_address(struct usb_device *dev)
 {
-       int res;
-
        debug("set address %d\n", dev->devnum);
-       res = usb_control_msg(dev, usb_snddefctrl(dev),
-                               USB_REQ_SET_ADDRESS, 0,
-                               (dev->devnum), 0,
-                               NULL, 0, USB_CNTL_TIMEOUT);
-       return res;
+
+       return usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS,
+                              0, (dev->devnum), 0, NULL, 0, USB_CNTL_TIMEOUT);
 }
 
 /********************************************************************
index 97f79f8eb8c10a966b9b267d9f964ebff60102fd..a9872a6b5ac94972e00ec8ce2a9923293e5e869d 100644 (file)
@@ -605,11 +605,8 @@ int usb_kbd_deregister(int force)
 static int usb_kbd_probe(struct udevice *dev)
 {
        struct usb_device *udev = dev_get_parent_priv(dev);
-       int ret;
-
-       ret = probe_usb_keyboard(udev);
 
-       return ret;
+       return probe_usb_keyboard(udev);
 }
 
 static int usb_kbd_remove(struct udevice *dev)
index 7e6e52d2ec37a2383935721332a31e2636317e98..0345aa22eff5f79e6266b7ce7fd07a3207674d27 100644 (file)
@@ -708,13 +708,10 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us)
 /* clear a stall on an endpoint - special for BBB devices */
 static int usb_stor_BBB_clear_endpt_stall(struct us_data *us, __u8 endpt)
 {
-       int result;
-
        /* ENDPOINT_HALT = 0, so set value to 0 */
-       result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
-                               USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT,
-                               0, endpt, NULL, 0, USB_CNTL_TIMEOUT * 5);
-       return result;
+       return usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
+                              USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0,
+                              endpt, NULL, 0, USB_CNTL_TIMEOUT * 5);
 }
 
 static int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
index bdcd4f1c991692dff9fea363258a479dc32104e8..6ff450cc758ea95960c8b1dd56bc34a0461bf387 100644 (file)
@@ -129,15 +129,10 @@ static int xhci_fsl_probe(struct udevice *dev)
 static int xhci_fsl_remove(struct udevice *dev)
 {
        struct xhci_fsl_priv *priv = dev_get_priv(dev);
-       int ret;
 
        fsl_xhci_core_exit(&priv->ctx);
 
-       ret = xhci_deregister(dev);
-       if (ret)
-               return ret;
-
-       return 0;
+       return xhci_deregister(dev);
 }
 
 static const struct udevice_id xhci_usb_ids[] = {