Fix six occurrences of the checkpatch.pl error:

ERROR: do not use assignment in if condition

The semantic patch that makes this change is:

// <smpl>
@@
identifier i;
expression E;
statement S1, S2;
@@

+ i = E;
  if (
- (i = E)
+ i
  ) S1 else S2

@@
identifier i;
expression E;
statement S;
constant c;
binary operator b;
@@

+ i = E;
  if (
- (i = E)
+ i
  b
  c ) S
// </smpl>

Signed-off-by: Kris Borer <kbo...@gmail.com>
---
 drivers/usb/core/devio.c | 78 +++++++++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 986abde..4b6521b 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1082,7 +1082,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
__user *arg)
        ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
        if (ret)
                return ret;
-       if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
+       tbuf = kmalloc(len1, GFP_KERNEL);
+       if (!tbuf) {
                ret = -ENOMEM;
                goto done;
        }
@@ -1224,7 +1225,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
__user *arg)
 
        if (copy_from_user(&setintf, arg, sizeof(setintf)))
                return -EFAULT;
-       if ((ret = checkintf(ps, setintf.interface)))
+       ret = checkintf(ps, setintf.interface);
+       if (ret)
                return ret;
 
        destroy_async_on_interface(ps, setintf.interface);
@@ -1393,7 +1395,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
                number_of_packets = uurb->number_of_packets;
                isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
                                   number_of_packets;
-               if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
+               isopkt = kmalloc(isofrmlen, GFP_KERNEL);
+               if (!isopkt)
                        return -ENOMEM;
                if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
                        ret = -EFAULT;
@@ -1904,7 +1907,8 @@ static int proc_releaseinterface(struct usb_dev_state 
*ps, void __user *arg)
 
        if (get_user(ifnum, (unsigned int __user *)arg))
                return -EFAULT;
-       if ((ret = releaseintf(ps, ifnum)) < 0)
+       ret = releaseintf(ps, ifnum);
+       if (ret < 0)
                return ret;
        destroy_async_on_interface (ps, ifnum);
        return 0;
@@ -1919,7 +1923,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
        struct usb_driver       *driver = NULL;
 
        /* alloc buffer */
-       if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
+       size = _IOC_SIZE(ctl->ioctl_code);
+       if (size > 0) {
                buf = kmalloc(size, GFP_KERNEL);
                if (buf == NULL)
                        return -ENOMEM;
@@ -1940,38 +1945,43 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
 
        if (ps->dev->state != USB_STATE_CONFIGURED)
                retval = -EHOSTUNREACH;
-       else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno)))
-               retval = -EINVAL;
-       else switch (ctl->ioctl_code) {
-
-       /* disconnect kernel driver from interface */
-       case USBDEVFS_DISCONNECT:
-               if (intf->dev.driver) {
-                       driver = to_usb_driver(intf->dev.driver);
-                       dev_dbg(&intf->dev, "disconnect by usbfs\n");
-                       usb_driver_release_interface(driver, intf);
-               } else
-                       retval = -ENODATA;
-               break;
-
-       /* let kernel drivers try to (re)bind to the interface */
-       case USBDEVFS_CONNECT:
-               if (!intf->dev.driver)
-                       retval = device_attach(&intf->dev);
+       else {
+               intf = usb_ifnum_to_if(ps->dev, ctl->ifno);
+               if (!intf)
+                       retval = -EINVAL;
                else
-                       retval = -EBUSY;
-               break;
+               switch (ctl->ioctl_code) {
+
+               /* disconnect kernel driver from interface */
+               case USBDEVFS_DISCONNECT:
+                       if (intf->dev.driver) {
+                               driver = to_usb_driver(intf->dev.driver);
+                               dev_dbg(&intf->dev, "disconnect by usbfs\n");
+                               usb_driver_release_interface(driver, intf);
+                       } else
+                               retval = -ENODATA;
+                       break;
 
-       /* talk directly to the interface's driver */
-       default:
-               if (intf->dev.driver)
-                       driver = to_usb_driver(intf->dev.driver);
-               if (driver == NULL || driver->unlocked_ioctl == NULL) {
-                       retval = -ENOTTY;
-               } else {
-                       retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, 
buf);
-                       if (retval == -ENOIOCTLCMD)
+               /* let kernel drivers try to (re)bind to the interface */
+               case USBDEVFS_CONNECT:
+                       if (!intf->dev.driver)
+                               retval = device_attach(&intf->dev);
+                       else
+                               retval = -EBUSY;
+                       break;
+
+               /* talk directly to the interface's driver */
+               default:
+                       if (intf->dev.driver)
+                               driver = to_usb_driver(intf->dev.driver);
+                       if (driver == NULL || driver->unlocked_ioctl == NULL) {
                                retval = -ENOTTY;
+                       } else {
+                               retval = driver->unlocked_ioctl(intf,
+                                               ctl->ioctl_code, buf);
+                               if (retval == -ENOIOCTLCMD)
+                                       retval = -ENOTTY;
+                       }
                }
        }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to