]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
wl12xx: wrong values are returned in gpio_power_write()
authorEliad Peller <eliad@wizery.com>
Sun, 23 Jan 2011 10:25:27 +0000 (11:25 +0100)
committerLuciano Coelho <coelho@ti.com>
Mon, 24 Jan 2011 21:15:11 +0000 (23:15 +0200)
Return values were assigned to incorrect var / weren't assigned.
fix it, and defer mutex_lock after the sanity checks.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/debugfs.c

index dc3ca0031817699d952bb3135dc8823d5b911662..bebfa28a171abbe598263bfd4af74afb94594382 100644 (file)
@@ -261,27 +261,25 @@ static ssize_t gpio_power_write(struct file *file,
        unsigned long value;
        int ret;
 
-       mutex_lock(&wl->mutex);
-
        len = min(count, sizeof(buf) - 1);
        if (copy_from_user(buf, user_buf, len)) {
-               ret = -EFAULT;
-               goto out;
+               return -EFAULT;
        }
        buf[len] = '\0';
 
        ret = strict_strtoul(buf, 0, &value);
        if (ret < 0) {
                wl1271_warning("illegal value in gpio_power");
-               goto out;
+               return -EINVAL;
        }
 
+       mutex_lock(&wl->mutex);
+
        if (value)
                wl1271_power_on(wl);
        else
                wl1271_power_off(wl);
 
-out:
        mutex_unlock(&wl->mutex);
        return count;
 }