s390/ccwgroup: fix an uninitialized return code
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Fri, 13 Jun 2014 15:29:11 +0000 (17:29 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jun 2014 08:32:38 +0000 (10:32 +0200)
Since commit 0b60f9ead5d4816e7e3d6e28f4a0d22d4a1b2513
"s390: use device_remove_file_self() instead of device_schedule_callback()"
the return code of ccwgroup_ungroup_store is uninitialized. Make
sure the rc is always initialized.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/ccwgroup.c

index 040e643..4ec1987 100644 (file)
@@ -184,7 +184,7 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev,
                                      const char *buf, size_t count)
 {
        struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
-       int rc;
+       int rc = 0;
 
        /* Prevent concurrent online/offline processing and ungrouping. */
        if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
@@ -196,11 +196,12 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev,
 
        if (device_remove_file_self(dev, attr))
                ccwgroup_ungroup(gdev);
+       else
+               rc = -ENODEV;
 out:
        if (rc) {
-               if (rc != -EAGAIN)
-                       /* Release onoff "lock" when ungrouping failed. */
-                       atomic_set(&gdev->onoff, 0);
+               /* Release onoff "lock" when ungrouping failed. */
+               atomic_set(&gdev->onoff, 0);
                return rc;
        }
        return count;