aboutsummaryrefslogtreecommitdiffstats
path: root/0017-speedtch.c-move-assignment-out-of-if-block.patch
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-29 16:24:28 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-29 16:24:28 +0200
commit24b1c251dfcd02877c40d7e52288c9bc2dc7ff35 (patch)
tree8fb3d4332168686f601f58b23815910799b1699f /0017-speedtch.c-move-assignment-out-of-if-block.patch
parent71c7e32cd1509d46be836ed19dfe63e217eae8d4 (diff)
downloadpatches-24b1c251dfcd02877c40d7e52288c9bc2dc7ff35.tar.gz
updates and new patches
Diffstat (limited to '0017-speedtch.c-move-assignment-out-of-if-block.patch')
-rw-r--r--0017-speedtch.c-move-assignment-out-of-if-block.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/0017-speedtch.c-move-assignment-out-of-if-block.patch b/0017-speedtch.c-move-assignment-out-of-if-block.patch
new file mode 100644
index 00000000000000..1033e4a2bb4d0f
--- /dev/null
+++ b/0017-speedtch.c-move-assignment-out-of-if-block.patch
@@ -0,0 +1,79 @@
+From 621ba9de84b27122635c9198b8db5c7b87dd811f Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Wed, 29 Apr 2015 16:22:12 +0200
+Subject: [PATCH 17/36] speedtch.c: move assignment out of if () block
+
+We should not be doing assignments within an if () block
+so fix up the code to not do this.
+
+change was created using Coccinelle.
+
+CC: Duncan Sands <duncan.sands@free.fr>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/atm/speedtch.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
+index 0dc8c06a7b5f..0270d1312f83 100644
+--- a/drivers/usb/atm/speedtch.c
++++ b/drivers/usb/atm/speedtch.c
+@@ -255,7 +255,8 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
+
+ usb_dbg(usbatm, "%s entered\n", __func__);
+
+- if (!(buffer = (unsigned char *)__get_free_page(GFP_KERNEL))) {
++ buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
++ if (!buffer) {
+ ret = -ENOMEM;
+ usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__);
+ goto out;
+@@ -638,7 +639,8 @@ static void speedtch_handle_int(struct urb *int_urb)
+ goto fail;
+ }
+
+- if ((int_urb = instance->int_urb)) {
++ int_urb = instance->int_urb;
++ if (int_urb) {
+ ret = usb_submit_urb(int_urb, GFP_ATOMIC);
+ schedule_work(&instance->status_check_work);
+ if (ret < 0) {
+@@ -650,7 +652,8 @@ static void speedtch_handle_int(struct urb *int_urb)
+ return;
+
+ fail:
+- if ((int_urb = instance->int_urb))
++ int_urb = instance->int_urb;
++ if (int_urb)
+ mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY));
+ }
+
+@@ -759,11 +762,13 @@ static void speedtch_release_interfaces(struct usb_device *usb_dev,
+ struct usb_interface *cur_intf;
+ int i;
+
+- for (i = 0; i < num_interfaces; i++)
+- if ((cur_intf = usb_ifnum_to_if(usb_dev, i))) {
++ for (i = 0; i < num_interfaces; i++) {
++ cur_intf = usb_ifnum_to_if(usb_dev, i);
++ if (cur_intf) {
+ usb_set_intfdata(cur_intf, NULL);
+ usb_driver_release_interface(&speedtch_usb_driver, cur_intf);
+ }
++ }
+ }
+
+ static int speedtch_bind(struct usbatm_data *usbatm,
+@@ -787,7 +792,8 @@ static int speedtch_bind(struct usbatm_data *usbatm,
+ return -ENODEV;
+ }
+
+- if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) {
++ data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA);
++ if (!data_intf) {
+ usb_err(usbatm, "%s: data interface not found!\n", __func__);
+ return -ENODEV;
+ }
+--
+2.3.7
+