mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oscar Carter <oscar.carter@gmx.com>
To: Forest Bond <forest@alittletooquiet.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oscar Carter <oscar.carter@gmx.com>,
	Malcolm Priestley <tvboxspy@gmail.com>,
	Quentin Deslandes <quentin.deslandes@itdev.co.uk>,
	"John B. Wyatt IV" <jbwyatt4@gmail.com>,
	Colin Ian King <colin.king@canonical.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] staging: vt6656: Check the return values in vnt_set_bss_mode function
Date: Wed, 29 Apr 2020 17:23:06 +0200	[thread overview]
Message-ID: <20200429152307.5871-2-oscar.carter@gmx.com> (raw)
In-Reply-To: <20200429152307.5871-1-oscar.carter@gmx.com>

Check the return value of all the functions that return zero if
successful or a negative error code on failure inside the function
vnt_set_bss_mode.

Also, remove the unnecessary variable initialization as this variable is
set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
 drivers/staging/vt6656/card.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 872717f9df49..0854b70cb89f 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -471,12 +471,15 @@ int vnt_radio_power_on(struct vnt_private *priv)

 int vnt_set_bss_mode(struct vnt_private *priv)
 {
-	int ret = 0;
+	int ret;

 	if (priv->rf_type == RF_AIROHA7230 && priv->bb_type == BB_TYPE_11A)
-		vnt_mac_set_bb_type(priv, BB_TYPE_11G);
+		ret = vnt_mac_set_bb_type(priv, BB_TYPE_11G);
 	else
-		vnt_mac_set_bb_type(priv, priv->bb_type);
+		ret = vnt_mac_set_bb_type(priv, priv->bb_type);
+
+	if (ret)
+		return ret;

 	priv->packet_type = vnt_get_pkt_type(priv);

@@ -492,8 +495,13 @@ int vnt_set_bss_mode(struct vnt_private *priv)
 	if (ret)
 		return ret;

-	vnt_update_ifs(priv);
-	vnt_set_rspinf(priv, (u8)priv->bb_type);
+	ret = vnt_update_ifs(priv);
+	if (ret)
+		return ret;
+
+	ret = vnt_set_rspinf(priv, (u8)priv->bb_type);
+	if (ret)
+		return ret;

 	if (priv->bb_type == BB_TYPE_11A) {
 		if (priv->rf_type == RF_AIROHA7230) {
@@ -521,6 +529,5 @@ int vnt_set_bss_mode(struct vnt_private *priv)
 		priv->bb_vga[3] = 0x0;
 	}

-	vnt_set_vga_gain_offset(priv, priv->bb_vga[0]);
-	return 0;
+	return vnt_set_vga_gain_offset(priv, priv->bb_vga[0]);
 }
--
2.20.1


  reply	other threads:[~2020-04-29 15:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 15:23 [PATCH 0/2] staging: vt6656: Refactor the " Oscar Carter
2020-04-29 15:23 ` Oscar Carter [this message]
2020-04-29 15:23 ` [PATCH 2/2] " Oscar Carter

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=20200429152307.5871-2-oscar.carter@gmx.com \
    --to=oscar.carter@gmx.com \
    --cc=colin.king@canonical.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbwyatt4@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.deslandes@itdev.co.uk \
    --cc=tvboxspy@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

all inboxes | Powered by JetHome®