linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wl12xx: wrong values are returned in gpio_power_write()
@ 2011-01-23 10:25 Eliad Peller
  2011-01-24 21:15 ` Luciano Coelho
  0 siblings, 1 reply; 2+ messages in thread
From: Eliad Peller @ 2011-01-23 10:25 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

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>
---
 drivers/net/wireless/wl12xx/debugfs.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 36e7ec1..1f85dc2 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -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;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wl12xx: wrong values are returned in gpio_power_write()
  2011-01-23 10:25 [PATCH] wl12xx: wrong values are returned in gpio_power_write() Eliad Peller
@ 2011-01-24 21:15 ` Luciano Coelho
  0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2011-01-24 21:15 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless@vger.kernel.org

On Sun, 2011-01-23 at 11:25 +0100, Eliad Peller wrote:
> 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>
> ---

Looks good.  Applied, thanks!

-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-23 10:25 [PATCH] wl12xx: wrong values are returned in gpio_power_write() Eliad Peller
2011-01-24 21:15 ` Luciano Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).