[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190520163844.1225-8-quentin.deslandes@itdev.co.uk>
Date: Mon, 20 May 2019 16:39:05 +0000
From: Quentin Deslandes <quentin.deslandes@...ev.co.uk>
To: "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>
CC: Forest Bond <forest@...ttletooquiet.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Quentin Deslandes <quentin.deslandes@...ev.co.uk>,
Mukesh Ojha <mojha@...eaurora.org>,
Ojaswin Mujoo <ojaswin25111998@...il.com>,
Nishad Kamdar <nishadkamdar@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 7/7] staging: vt6656: manage error path during device
initialization
Check for error during device initialization callback and return a
meaningful error code or zero on success.
Signed-off-by: Quentin Deslandes <quentin.deslandes@...ev.co.uk>
---
drivers/staging/vt6656/main_usb.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 8ed96e8eedbe..856ba97aec4f 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -529,28 +529,34 @@ static void vnt_tx_80211(struct ieee80211_hw *hw,
static int vnt_start(struct ieee80211_hw *hw)
{
+ int ret = 0;
struct vnt_private *priv = hw->priv;
priv->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS;
- if (!vnt_alloc_bufs(priv)) {
+ ret = vnt_alloc_bufs(priv);
+ if (ret) {
dev_dbg(&priv->usb->dev, "vnt_alloc_bufs fail...\n");
- return -ENOMEM;
+ goto err;
}
clear_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags);
- if (vnt_init_registers(priv) == false) {
+ ret = vnt_init_registers(priv);
+ if (ret) {
dev_dbg(&priv->usb->dev, " init register fail\n");
goto free_all;
}
- if (vnt_key_init_table(priv))
+ ret = vnt_key_init_table(priv);
+ if (ret)
goto free_all;
priv->int_interval = 1; /* bInterval is set to 1 */
- vnt_int_start_interrupt(priv);
+ ret = vnt_int_start_interrupt(priv);
+ if (ret)
+ goto free_all;
ieee80211_wake_queues(hw);
@@ -563,8 +569,8 @@ static int vnt_start(struct ieee80211_hw *hw)
usb_kill_urb(priv->interrupt_urb);
usb_free_urb(priv->interrupt_urb);
-
- return -ENOMEM;
+err:
+ return ret;
}
static void vnt_stop(struct ieee80211_hw *hw)
--
2.17.1
Powered by blists - more mailing lists