linux-safety.lists.elisa.tech archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: net: Tidy codeblocks and remove unused assignments
@ 2021-11-29 15:01 Milan Lakhani
  2021-11-29 15:01 ` [linux-safety] " Milan Lakhani
  0 siblings, 1 reply; 2+ messages in thread
From: Milan Lakhani @ 2021-11-29 15:01 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn, sudip.mukherjee; +Cc: Milan Lakhani

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 .../net/wireless/marvell/mwifiex/debugfs.c    | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index dded92db1f37..7051d1066dab 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -471,33 +471,33 @@ mwifiex_regrdwr_read(struct file *file, char __user *ubuf,
 
 	if (!saved_reg_type) {
 		/* No command has been given */
-		pos += snprintf(buf, PAGE_SIZE, "0");
 		goto done;
 	}
-	/* Set command has been given */
+
 	if (saved_reg_value != UINT_MAX) {
-		ret = mwifiex_reg_write(priv, saved_reg_type, saved_reg_offset,
-					saved_reg_value);
+		/* Set command has been given */
+		mwifiex_reg_write(priv, saved_reg_type, saved_reg_offset,
+				saved_reg_value);
 
 		pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n",
 				saved_reg_type, saved_reg_offset,
 				saved_reg_value);
 
-		ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+	} else {
+		/* Get command has been given */
+		ret = mwifiex_reg_read(priv, saved_reg_type,
+				saved_reg_offset, &reg_value);
 
-		goto done;
-	}
-	/* Get command has been given */
-	ret = mwifiex_reg_read(priv, saved_reg_type,
-			       saved_reg_offset, &reg_value);
-	if (ret) {
-		ret = -EINVAL;
-		goto done;
+		if (ret) {
+			ret = -EINVAL;
+			goto done;
+		} else {
+			pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n",
+					saved_reg_type, saved_reg_offset,
+					reg_value);
+		}
 	}
 
-	pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", saved_reg_type,
-			saved_reg_offset, reg_value);
-
 	ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
 
 done:
-- 
2.25.1



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

* [linux-safety] [PATCH] staging: net: Tidy codeblocks and remove unused assignments
  2021-11-29 15:01 [PATCH] staging: net: Tidy codeblocks and remove unused assignments Milan Lakhani
@ 2021-11-29 15:01 ` Milan Lakhani
  0 siblings, 0 replies; 2+ messages in thread
From: Milan Lakhani @ 2021-11-29 15:01 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn, sudip.mukherjee; +Cc: Milan Lakhani

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 .../net/wireless/marvell/mwifiex/debugfs.c    | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index dded92db1f37..7051d1066dab 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -471,33 +471,33 @@ mwifiex_regrdwr_read(struct file *file, char __user *ubuf,
 
 	if (!saved_reg_type) {
 		/* No command has been given */
-		pos += snprintf(buf, PAGE_SIZE, "0");
 		goto done;
 	}
-	/* Set command has been given */
+
 	if (saved_reg_value != UINT_MAX) {
-		ret = mwifiex_reg_write(priv, saved_reg_type, saved_reg_offset,
-					saved_reg_value);
+		/* Set command has been given */
+		mwifiex_reg_write(priv, saved_reg_type, saved_reg_offset,
+				saved_reg_value);
 
 		pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n",
 				saved_reg_type, saved_reg_offset,
 				saved_reg_value);
 
-		ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+	} else {
+		/* Get command has been given */
+		ret = mwifiex_reg_read(priv, saved_reg_type,
+				saved_reg_offset, &reg_value);
 
-		goto done;
-	}
-	/* Get command has been given */
-	ret = mwifiex_reg_read(priv, saved_reg_type,
-			       saved_reg_offset, &reg_value);
-	if (ret) {
-		ret = -EINVAL;
-		goto done;
+		if (ret) {
+			ret = -EINVAL;
+			goto done;
+		} else {
+			pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n",
+					saved_reg_type, saved_reg_offset,
+					reg_value);
+		}
 	}
 
-	pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", saved_reg_type,
-			saved_reg_offset, reg_value);
-
 	ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
 
 done:
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#264): https://lists.elisa.tech/g/linux-safety/message/264
Mute This Topic: https://lists.elisa.tech/mt/87379258/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2021-11-29 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 15:01 [PATCH] staging: net: Tidy codeblocks and remove unused assignments Milan Lakhani
2021-11-29 15:01 ` [linux-safety] " Milan Lakhani

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).