提交 8e2de74e 编写于 作者: E Eliad Peller 提交者: Luciano Coelho

wl12xx: wrong values are returned in gpio_power_write()

Return values were assigned to incorrect var / weren't assigned.
fix it, and defer mutex_lock after the sanity checks.
Signed-off-by: NEliad Peller <eliad@wizery.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 bbba3e68
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册