USB: mon_main.c: move assignment out of if () block
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Apr 2015 09:32:57 +0000 (11:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 May 2015 14:01:11 +0000 (16:01 +0200)
We should not be doing assignments within an if () block
so fix up the code to not do this.

change was created using Coccinelle.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
drivers/usb/mon/mon_main.c

index 1040511..f7c292f 100644 (file)
@@ -96,7 +96,8 @@ static void mon_submit(struct usb_bus *ubus, struct urb *urb)
 {
        struct mon_bus *mbus;
 
-       if ((mbus = ubus->mon_bus) != NULL)
+       mbus = ubus->mon_bus;
+       if (mbus != NULL)
                mon_bus_submit(mbus, urb);
        mon_bus_submit(&mon_bus0, urb);
 }
@@ -122,7 +123,8 @@ static void mon_submit_error(struct usb_bus *ubus, struct urb *urb, int error)
 {
        struct mon_bus *mbus;
 
-       if ((mbus = ubus->mon_bus) != NULL)
+       mbus = ubus->mon_bus;
+       if (mbus != NULL)
                mon_bus_submit_error(mbus, urb, error);
        mon_bus_submit_error(&mon_bus0, urb, error);
 }
@@ -148,7 +150,8 @@ static void mon_complete(struct usb_bus *ubus, struct urb *urb, int status)
 {
        struct mon_bus *mbus;
 
-       if ((mbus = ubus->mon_bus) != NULL)
+       mbus = ubus->mon_bus;
+       if (mbus != NULL)
                mon_bus_complete(mbus, urb, status);
        mon_bus_complete(&mon_bus0, urb, status);
 }
@@ -280,7 +283,8 @@ static void mon_bus_init(struct usb_bus *ubus)
 {
        struct mon_bus *mbus;
 
-       if ((mbus = kzalloc(sizeof(struct mon_bus), GFP_KERNEL)) == NULL)
+       mbus = kzalloc(sizeof(struct mon_bus), GFP_KERNEL);
+       if (mbus == NULL)
                goto err_alloc;
        kref_init(&mbus->ref);
        spin_lock_init(&mbus->lock);