Removed unnecessary code.
authorFlorian Pose <fp@igh-essen.com>
Thu, 12 Jun 2008 09:19:06 +0000
changeset 999 14307580deb6
parent 998 05a24788f3b2
child 1000 5746fdd1ca2e
Removed unnecessary code.
master/cdev.c
--- a/master/cdev.c	Thu Jun 12 08:31:06 2008 +0000
+++ b/master/cdev.c	Thu Jun 12 09:19:06 2008 +0000
@@ -160,16 +160,10 @@
                 data.devices[1].tx_count = master->backup_device.tx_count;
                 data.devices[1].rx_count = master->backup_device.rx_count;
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
-
-                break;
-            }
-
-            retval = master->slave_count;
-            break;
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
+                break;
+            }
 
         case EC_IOCTL_SLAVE:
             {
@@ -217,11 +211,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
-
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -259,10 +250,8 @@
                 data.assign_source = sync->assign_source;
                 data.pdo_count = ec_pdo_list_count(&sync->pdos);
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -313,10 +302,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -376,10 +363,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -409,10 +394,8 @@
                 data.expected_working_counter = domain->expected_working_counter;
                 data.fmmu_count = ec_domain_fmmu_count(domain);
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -446,10 +429,8 @@
                 data.logical_address = fmmu->logical_start_address;
                 data.data_size = fmmu->data_size;
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -477,19 +458,16 @@
                 }
 
                 if (copy_to_user((void __user *) data.target, domain->data,
-                            domain->data_size)) {
-                    retval = -EFAULT;
-                    break;
-                }
+                            domain->data_size))
+                    retval = -EFAULT;
                 break;
             }
 
         case EC_IOCTL_SET_DEBUG:
             if (!(filp->f_mode & FMODE_WRITE))
                 return -EPERM;
-            if (ec_master_debug_level(master, (unsigned int) arg)) {
+            if (ec_master_debug_level(master, (unsigned int) arg))
                 retval = -EINVAL;
-            }
             break;
 
         case EC_IOCTL_SLAVE_STATE:
@@ -552,10 +530,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -617,10 +593,8 @@
                     data.description[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -798,10 +772,8 @@
                 }
 
                 if (copy_to_user((void __user *) data.words,
-                            slave->sii_words + data.offset, data.nwords * 2)) {
-                    retval = -EFAULT;
-                    break;
-                }
+                            slave->sii_words + data.offset, data.nwords * 2))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -843,11 +815,8 @@
                 }
 
                 if (ec_slave_write_sii(slave,
-                            data.offset, data.nwords, words)) {
+                            data.offset, data.nwords, words))
                     retval = -EIO;
-                    kfree(words);
-                    break;
-                }
 
                 kfree(words);
                 break;
@@ -882,10 +851,8 @@
                 data.sdo_count = ec_slave_config_sdo_count(sc);
                 data.attached = sc->slave != NULL;
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -931,10 +898,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -988,10 +953,8 @@
                     data.name[0] = 0;
                 }
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }
 
@@ -1026,10 +989,8 @@
                 data.size = req->data_size;
                 memcpy(&data.data, req->data, min((u32) data.size, (u32) 4));
 
-                if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
-                    retval = -EFAULT;
-                    break;
-                }
+                if (copy_to_user((void __user *) arg, &data, sizeof(data)))
+                    retval = -EFAULT;
                 break;
             }