linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
To: "kernel-janitors@vger.kernel.org" <kernel-janitors@vger.kernel.org>
Cc: Quentin Deslandes <quentin.deslandes@itdev.co.uk>,
	Forest Bond <forest@alittletooquiet.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mukesh Ojha <mojha@codeaurora.org>,
	Ojaswin Mujoo <ojaswin25111998@gmail.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] staging: vt6656: returns error code on vnt_int_start_interrupt fail
Date: Thu, 16 May 2019 11:57:15 +0000	[thread overview]
Message-ID: <20190516115653.15120-1-quentin.deslandes@itdev.co.uk> (raw)
In-Reply-To: <20190516093046.1400-1-quentin.deslandes@itdev.co.uk>

Returns error code from 'vnt_int_start_interrupt()' so the device's private
buffers will be correctly freed and 'struct ieee80211_hw' start function
will return an error code.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
---
 drivers/staging/vt6656/int.c      |  4 +++-
 drivers/staging/vt6656/int.h      |  2 +-
 drivers/staging/vt6656/main_usb.c | 12 +++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 504424b19fcf..f3ee2198e1b3 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -39,7 +39,7 @@ static const u8 fallback_rate1[5][5] = {
 	{RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
 };
 
-void vnt_int_start_interrupt(struct vnt_private *priv)
+int vnt_int_start_interrupt(struct vnt_private *priv)
 {
 	unsigned long flags;
 	int status;
@@ -51,6 +51,8 @@ void vnt_int_start_interrupt(struct vnt_private *priv)
 	status = vnt_start_interrupt_urb(priv);
 
 	spin_unlock_irqrestore(&priv->lock, flags);
+
+	return status;
 }
 
 static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
index 987c454e99e9..8a6d60569ceb 100644
--- a/drivers/staging/vt6656/int.h
+++ b/drivers/staging/vt6656/int.h
@@ -41,7 +41,7 @@ struct vnt_interrupt_data {
 	u8 sw[2];
 } __packed;
 
-void vnt_int_start_interrupt(struct vnt_private *priv);
+int vnt_int_start_interrupt(struct vnt_private *priv);
 void vnt_int_process_data(struct vnt_private *priv);
 
 #endif /* __INT_H__ */
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index ccafcc2c87ac..71e10b9ae253 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -483,6 +483,7 @@ static void vnt_tx_80211(struct ieee80211_hw *hw,
 
 static int vnt_start(struct ieee80211_hw *hw)
 {
+	int err = 0;
 	struct vnt_private *priv = hw->priv;
 
 	priv->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS;
@@ -496,15 +497,20 @@ static int vnt_start(struct ieee80211_hw *hw)
 
 	if (vnt_init_registers(priv) == false) {
 		dev_dbg(&priv->usb->dev, " init register fail\n");
+		err = -ENOMEM;
 		goto free_all;
 	}
 
-	if (vnt_key_init_table(priv))
+	if (vnt_key_init_table(priv)) {
+		err = -ENOMEM;
 		goto free_all;
+	}
 
 	priv->int_interval = 1;  /* bInterval is set to 1 */
 
-	vnt_int_start_interrupt(priv);
+	err = vnt_int_start_interrupt(priv);
+	if (err)
+		goto free_all;
 
 	ieee80211_wake_queues(hw);
 
@@ -518,7 +524,7 @@ static int vnt_start(struct ieee80211_hw *hw)
 	usb_kill_urb(priv->interrupt_urb);
 	usb_free_urb(priv->interrupt_urb);
 
-	return -ENOMEM;
+	return err;
 }
 
 static void vnt_stop(struct ieee80211_hw *hw)
-- 
2.17.1


  parent reply	other threads:[~2019-05-16 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16  9:31 [PATCH] staging: vt6656: remove unused variable Quentin Deslandes
2019-05-16  9:39 ` Greg Kroah-Hartman
2019-05-16  9:50   ` Quentin Deslandes
2019-05-16 10:19     ` Greg Kroah-Hartman
2019-05-16 10:27       ` Quentin Deslandes
2019-05-16 11:22 ` [PATCH] staging: vt6656: returns error code on vnt_int_start_interrupt fail Quentin Deslandes
2019-05-16 11:57 ` Quentin Deslandes [this message]
2019-05-17  7:31   ` [PATCH v2] " Greg Kroah-Hartman
2019-05-17  7:53 ` [PATCH v3] " Quentin Deslandes
2019-05-17  9:17   ` Greg Kroah-Hartman
2019-05-17 13:15     ` Quentin Deslandes
2019-05-17 13:29       ` Greg Kroah-Hartman

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=20190516115653.15120-1-quentin.deslandes@itdev.co.uk \
    --to=quentin.deslandes@itdev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mojha@codeaurora.org \
    --cc=ojaswin25111998@gmail.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;
as well as URLs for NNTP newsgroup(s).