linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ath9k: Fine-tuning for some function implementations
@ 2017-05-09  7:25 SF Markus Elfring
  2017-05-09  7:26 ` [PATCH 1/3] ath9k: Reduce function calls for sequence output in read_file_dma() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-09  7:25 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, netdev, Kalle Valo; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 09:19:09 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Reduce function calls for sequence output in read_file_dma()
  Replace four seq_printf() calls by seq_putc()
  Adjust a null pointer check in three functions

 drivers/net/wireless/ath/ath9k/debug.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

-- 
2.12.2

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

* [PATCH 1/3] ath9k: Reduce function calls for sequence output in read_file_dma()
  2017-05-09  7:25 [PATCH 0/3] ath9k: Fine-tuning for some function implementations SF Markus Elfring
@ 2017-05-09  7:26 ` SF Markus Elfring
  2017-05-09  7:28 ` [PATCH 2/3] ath9k: Replace four seq_printf() calls by seq_putc() SF Markus Elfring
  2017-05-09  7:29 ` [PATCH 3/3] ath9k: Adjust a null pointer check in three functions SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-09  7:26 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, netdev, Kalle Valo; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 21:55:09 +0200

Some data were put into a sequence by separate function calls.
Print the same data with two function calls less.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ath/ath9k/debug.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 2e64977a8ab6..981b38a1e352 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -427,9 +427,7 @@ static int read_file_dma(struct seq_file *file, void *data)
 		seq_printf(file, "%d: %08x ", i, val[i]);
 	}
 
-	seq_puts(file, "\n\n");
-	seq_puts(file, "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
-
+	seq_puts(file, "\n\nNum QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
 	for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) {
 		if (i == 8) {
 			qcuOffset = 0;
@@ -448,9 +446,8 @@ static int read_file_dma(struct seq_file *file, void *data)
 			   (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
 	}
 
-	seq_puts(file, "\n");
-
-	seq_printf(file, "qcu_stitch state:   %2x    qcu_fetch state:        %2x\n",
+	seq_printf(file,
+		   "\nqcu_stitch state:   %2x    qcu_fetch state:        %2x\n",
 		   (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22);
 	seq_printf(file, "qcu_complete state: %2x    dcu_complete state:     %2x\n",
 		   (val[3] & 0x1c000000) >> 26, (val[6] & 0x3));
-- 
2.12.2

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

* [PATCH 2/3] ath9k: Replace four seq_printf() calls by seq_putc()
  2017-05-09  7:25 [PATCH 0/3] ath9k: Fine-tuning for some function implementations SF Markus Elfring
  2017-05-09  7:26 ` [PATCH 1/3] ath9k: Reduce function calls for sequence output in read_file_dma() SF Markus Elfring
@ 2017-05-09  7:28 ` SF Markus Elfring
  2017-05-09  7:29 ` [PATCH 3/3] ath9k: Adjust a null pointer check in three functions SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-09  7:28 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, netdev, Kalle Valo; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 22:04:47 +0200

Four single characters (line breaks) should be put into a sequence.
Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ath/ath9k/debug.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 981b38a1e352..0d215598193c 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -421,7 +421,7 @@ static int read_file_dma(struct seq_file *file, void *data)
 
 	for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) {
 		if (i % 4 == 0)
-			seq_puts(file, "\n");
+			seq_putc(file, '\n');
 
 		val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
 		seq_printf(file, "%d: %08x ", i, val[i]);
@@ -702,8 +702,7 @@ static int read_file_misc(struct seq_file *file, void *data)
 	if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER)
 		seq_puts(file, " CONTROL_WRAPPER");
 
-	seq_puts(file, "\n");
-
+	seq_putc(file, '\n');
 	reg = sc->sc_ah->imask;
 
 	seq_printf(file, "INTERRUPT-MASK: 0x%x", reg);
@@ -723,8 +722,7 @@ static int read_file_misc(struct seq_file *file, void *data)
 	if (reg & ATH9K_INT_BB_WATCHDOG)
 		seq_puts(file, " BB_WATCHDOG");
 
-	seq_puts(file, "\n");
-
+	seq_putc(file, '\n');
 	i = 0;
 	ath_for_each_chanctx(sc, ctx) {
 		if (list_empty(&ctx->vifs))
@@ -981,7 +979,7 @@ static int read_file_dump_nfcal(struct seq_file *file, void *data)
 		seq_printf(file, " %d\t %d\t %d\t\t", i, h[i].privNF, nread);
 		for (j = 0; j < nread; j++)
 			seq_printf(file, " %d", h[i].nfCalBuffer[j]);
-		seq_puts(file, "\n");
+		seq_putc(file, '\n');
 	}
 
 	return 0;
-- 
2.12.2

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

* [PATCH 3/3] ath9k: Adjust a null pointer check in three functions
  2017-05-09  7:25 [PATCH 0/3] ath9k: Fine-tuning for some function implementations SF Markus Elfring
  2017-05-09  7:26 ` [PATCH 1/3] ath9k: Reduce function calls for sequence output in read_file_dma() SF Markus Elfring
  2017-05-09  7:28 ` [PATCH 2/3] ath9k: Replace four seq_printf() calls by seq_putc() SF Markus Elfring
@ 2017-05-09  7:29 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-09  7:29 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, netdev, Kalle Valo; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 22:17:13 +0200

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written "!buf"

Thus adjust this expression.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ath/ath9k/debug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 0d215598193c..5f2c1d8e8e70 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -161,7 +161,7 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
 	};
 
 	buf = kzalloc(size, GFP_KERNEL);
-	if (buf == NULL)
+	if (!buf)
 		return -ENOMEM;
 
 	len += scnprintf(buf + len, size - len, "%15s: %s\n", "ANI",
@@ -315,7 +315,7 @@ static ssize_t read_file_antenna_diversity(struct file *file,
 	};
 
 	buf = kzalloc(size, GFP_KERNEL);
-	if (buf == NULL)
+	if (!buf)
 		return -ENOMEM;
 
 	if (!(pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) {
@@ -1008,7 +1008,7 @@ static ssize_t read_file_btcoex(struct file *file, char __user *user_buf,
 	size_t retval;
 
 	buf = kzalloc(size, GFP_KERNEL);
-	if (buf == NULL)
+	if (!buf)
 		return -ENOMEM;
 
 	if (!sc->sc_ah->common.btcoex_enabled) {
-- 
2.12.2

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

end of thread, other threads:[~2017-05-09  7:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09  7:25 [PATCH 0/3] ath9k: Fine-tuning for some function implementations SF Markus Elfring
2017-05-09  7:26 ` [PATCH 1/3] ath9k: Reduce function calls for sequence output in read_file_dma() SF Markus Elfring
2017-05-09  7:28 ` [PATCH 2/3] ath9k: Replace four seq_printf() calls by seq_putc() SF Markus Elfring
2017-05-09  7:29 ` [PATCH 3/3] ath9k: Adjust a null pointer check in three functions SF Markus Elfring

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