aboutsummaryrefslogtreecommitdiffstats
path: root/0011-synclink.c-move-assignment-out-of-if-block.patch
diff options
Diffstat (limited to '0011-synclink.c-move-assignment-out-of-if-block.patch')
-rw-r--r--0011-synclink.c-move-assignment-out-of-if-block.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/0011-synclink.c-move-assignment-out-of-if-block.patch b/0011-synclink.c-move-assignment-out-of-if-block.patch
new file mode 100644
index 00000000000000..e0fef214561fb6
--- /dev/null
+++ b/0011-synclink.c-move-assignment-out-of-if-block.patch
@@ -0,0 +1,73 @@
+From cc9562d7ce941cb6517f4fd8e93ae9e165887958 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Wed, 29 Apr 2015 16:22:08 +0200
+Subject: [PATCH 11/36] synclink.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: Jiri Slaby <jslaby@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/synclink.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
+index b7991707ffc0..2fac7123b274 100644
+--- a/drivers/tty/synclink.c
++++ b/drivers/tty/synclink.c
+@@ -4410,7 +4410,8 @@ static void synclink_cleanup(void)
+ printk("Unloading %s: %s\n", driver_name, driver_version);
+
+ if (serial_driver) {
+- if ((rc = tty_unregister_driver(serial_driver)))
++ rc = tty_unregister_driver(serial_driver);
++ if (rc)
+ printk("%s(%d) failed to unregister tty driver err=%d\n",
+ __FILE__,__LINE__,rc);
+ put_tty_driver(serial_driver);
+@@ -7751,7 +7752,8 @@ static int hdlcdev_open(struct net_device *dev)
+ printk("%s:hdlcdev_open(%s)\n",__FILE__,dev->name);
+
+ /* generic HDLC layer open processing */
+- if ((rc = hdlc_open(dev)))
++ rc = hdlc_open(dev);
++ if (rc)
+ return rc;
+
+ /* arbitrate between network and tty opens */
+@@ -8018,7 +8020,8 @@ static int hdlcdev_init(struct mgsl_struct *info)
+
+ /* allocate and initialize network and HDLC layer objects */
+
+- if (!(dev = alloc_hdlcdev(info))) {
++ dev = alloc_hdlcdev(info);
++ if (!dev) {
+ printk(KERN_ERR "%s:hdlc device allocation failure\n",__FILE__);
+ return -ENOMEM;
+ }
+@@ -8039,7 +8042,8 @@ static int hdlcdev_init(struct mgsl_struct *info)
+ hdlc->xmit = hdlcdev_xmit;
+
+ /* register objects with HDLC layer */
+- if ((rc = register_hdlc_device(dev))) {
++ rc = register_hdlc_device(dev);
++ if (rc) {
+ printk(KERN_WARNING "%s:unable to register hdlc device\n",__FILE__);
+ free_netdev(dev);
+ return rc;
+@@ -8075,7 +8079,8 @@ static int synclink_init_one (struct pci_dev *dev,
+ return -EIO;
+ }
+
+- if (!(info = mgsl_allocate_device())) {
++ info = mgsl_allocate_device();
++ if (!info) {
+ printk("can't allocate device instance data.\n");
+ return -EIO;
+ }
+--
+2.3.7
+