Linux wireless drivers development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Luciano Coelho <coelho@ti.com>, Shahar Levi <shahar_levi@ti.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	"open list:WL1271 WIRELESS D..." <linux-wireless@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch -next] wl12xx: fix recent change to wl1271_tm_cmd_nvs_push()
Date: Wed, 24 Aug 2011 14:31:39 +0300	[thread overview]
Message-ID: <20110824113139.GE5975@shale.localdomain> (raw)

bc765bf3b9a "wl12xx: 1281/1283 support - Loading FW & NVS" had two
problems.  The condition was written so that it failed if "len" was
not equal to sizeof(struct wl1271_nvs_file).  Also we need to release
the locks on these new error paths.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
index 88add68..10c1762 100644
--- a/drivers/net/wireless/wl12xx/testmode.c
+++ b/drivers/net/wireless/wl12xx/testmode.c
@@ -208,11 +208,17 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
 
 	kfree(wl->nvs);
 
-	if ((wl->chip.id == CHIP_ID_1283_PG20) &&
-	    (len != sizeof(struct wl128x_nvs_file)))
-		return -EINVAL;
-	else if (len != sizeof(struct wl1271_nvs_file))
-		return -EINVAL;
+	if (wl->chip.id == CHIP_ID_1283_PG20) {
+		if (len != sizeof(struct wl128x_nvs_file)) {
+			ret = -EINVAL;
+			goto out;
+		}
+	} else {
+		if (len != sizeof(struct wl1271_nvs_file)) {
+			ret = -EINVAL;
+			goto out;
+		}
+	}
 
 	wl->nvs = kzalloc(len, GFP_KERNEL);
 	if (!wl->nvs) {

             reply	other threads:[~2011-08-24 11:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 11:31 Dan Carpenter [this message]
2011-08-24 14:18 ` [patch -next] wl12xx: fix recent change to wl1271_tm_cmd_nvs_push() Luciano Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110824113139.GE5975@shale.localdomain \
    --to=error27@gmail.com \
    --cc=coelho@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=shahar_levi@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox