public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] block-AoE: Fine-tuning for six function implementations
@ 2017-05-08  7:55 SF Markus Elfring
  2017-05-08  7:56 ` [PATCH 1/3] block-aoe: Use seq_putc() in aoedisk_debugfs_show() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08  7:55 UTC (permalink / raw)
  To: kernel-janitors, Ed L. Cashin; +Cc: LKML

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

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

Markus Elfring (3):
  Use seq_putc() in aoedisk_debugfs_show()
  Adjust eight checks for null pointers
  Add spaces for better code readability

 drivers/block/aoe/aoeblk.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

-- 
2.12.2

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

* [PATCH 1/3] block-aoe: Use seq_putc() in aoedisk_debugfs_show()
  2017-05-08  7:55 [PATCH 0/3] block-AoE: Fine-tuning for six function implementations SF Markus Elfring
@ 2017-05-08  7:56 ` SF Markus Elfring
  2017-05-08  7:57 ` [PATCH 2/3] block-aoe: Adjust eight checks for null pointers SF Markus Elfring
  2017-05-08  7:58 ` [PATCH 3/3] block-aoe: Add spaces for better code readability SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08  7:56 UTC (permalink / raw)
  To: kernel-janitors, Ed L. Cashin; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 08:51:28 +0200

A single character (line break) 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/block/aoe/aoeblk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 027b876370bc..cfcf21ec123d 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -147,7 +147,7 @@ static int aoedisk_debugfs_show(struct seq_file *s, void *ignored)
 			seq_printf(s, "%c%s", c, ifp->nd->name);
 			c = ',';
 		}
-		seq_puts(s, "\n");
+		seq_putc(s, '\n');
 	}
 	spin_unlock_irqrestore(&d->lock, flags);
 
-- 
2.12.2

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

* [PATCH 2/3] block-aoe: Adjust eight checks for null pointers
  2017-05-08  7:55 [PATCH 0/3] block-AoE: Fine-tuning for six function implementations SF Markus Elfring
  2017-05-08  7:56 ` [PATCH 1/3] block-aoe: Use seq_putc() in aoedisk_debugfs_show() SF Markus Elfring
@ 2017-05-08  7:57 ` SF Markus Elfring
  2017-05-08  7:58 ` [PATCH 3/3] block-aoe: Add spaces for better code readability SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08  7:57 UTC (permalink / raw)
  To: kernel-janitors, Ed L. Cashin; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 09:19:22 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/block/aoe/aoeblk.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index cfcf21ec123d..a52555984e73 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -51,7 +51,7 @@ static ssize_t aoedisk_show_mac(struct device *dev,
 	struct aoedev *d = disk->private_data;
 	struct aoetgt *t = d->targets[0];
 
-	if (t == NULL)
+	if (!t)
 		return snprintf(page, PAGE_SIZE, "none\n");
 	return snprintf(page, PAGE_SIZE, "%pm\n", t->addr);
 }
@@ -84,7 +84,7 @@ static ssize_t aoedisk_show_netif(struct device *dev,
 
 	ne = nd;
 	nd = nds;
-	if (*nd == NULL)
+	if (!*nd)
 		return snprintf(page, PAGE_SIZE, "none\n");
 	for (p = page; nd < ne; nd++)
 		p += snprintf(p, PAGE_SIZE - (p-page), "%s%s",
@@ -194,10 +194,10 @@ aoedisk_add_debugfs(struct aoedev *d)
 	struct dentry *entry;
 	char *p;
 
-	if (aoe_debugfs_dir == NULL)
+	if (!aoe_debugfs_dir)
 		return;
 	p = strchr(d->gd->disk_name, '/');
-	if (p == NULL)
+	if (!p)
 		p = d->gd->disk_name;
 	else
 		p++;
@@ -369,7 +369,7 @@ aoeblk_gdalloc(void *vp)
 		return;
 
 	gd = alloc_disk(AOE_PARTITIONS);
-	if (gd == NULL) {
+	if (!gd) {
 		pr_err("aoe: cannot allocate disk structure for %ld.%d\n",
 			d->aoemajor, d->aoeminor);
 		goto err;
@@ -377,13 +377,13 @@ aoeblk_gdalloc(void *vp)
 
 	mp = mempool_create(MIN_BUFS, mempool_alloc_slab, mempool_free_slab,
 		buf_pool_cache);
-	if (mp == NULL) {
+	if (!mp) {
 		printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n",
 			d->aoemajor, d->aoeminor);
 		goto err_disk;
 	}
 	q = blk_init_queue(aoeblk_request, &d->lock);
-	if (q == NULL) {
+	if (!q) {
 		pr_err("aoe: cannot allocate block queue for %ld.%d\n",
 			d->aoemajor, d->aoeminor);
 		goto err_mempool;
@@ -452,7 +452,7 @@ aoeblk_init(void)
 	buf_pool_cache = kmem_cache_create("aoe_bufs",
 					   sizeof(struct buf),
 					   0, 0, NULL);
-	if (buf_pool_cache == NULL)
+	if (!buf_pool_cache)
 		return -ENOMEM;
 	aoe_debugfs_dir = debugfs_create_dir("aoe", NULL);
 	if (IS_ERR_OR_NULL(aoe_debugfs_dir)) {
-- 
2.12.2

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

* [PATCH 3/3] block-aoe: Add spaces for better code readability
  2017-05-08  7:55 [PATCH 0/3] block-AoE: Fine-tuning for six function implementations SF Markus Elfring
  2017-05-08  7:56 ` [PATCH 1/3] block-aoe: Use seq_putc() in aoedisk_debugfs_show() SF Markus Elfring
  2017-05-08  7:57 ` [PATCH 2/3] block-aoe: Adjust eight checks for null pointers SF Markus Elfring
@ 2017-05-08  7:58 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08  7:58 UTC (permalink / raw)
  To: kernel-janitors, Ed L. Cashin; +Cc: LKML

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

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

CHECK: spaces preferred around that '-' (ctx:VxV)

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/block/aoe/aoeblk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index a52555984e73..66adb2fb66d3 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -87,10 +87,10 @@ static ssize_t aoedisk_show_netif(struct device *dev,
 	if (!*nd)
 		return snprintf(page, PAGE_SIZE, "none\n");
 	for (p = page; nd < ne; nd++)
-		p += snprintf(p, PAGE_SIZE - (p-page), "%s%s",
-			p == page ? "" : ",", (*nd)->name);
-	p += snprintf(p, PAGE_SIZE - (p-page), "\n");
-	return p-page;
+		p += snprintf(p, PAGE_SIZE - (p - page), "%s%s",
+			      p == page ? "" : ",", (*nd)->name);
+	p += snprintf(p, PAGE_SIZE - (p - page), "\n");
+	return p - page;
 }
 /* firmware version */
 static ssize_t aoedisk_show_fwver(struct device *dev,
-- 
2.12.2

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-08  7:55 [PATCH 0/3] block-AoE: Fine-tuning for six function implementations SF Markus Elfring
2017-05-08  7:56 ` [PATCH 1/3] block-aoe: Use seq_putc() in aoedisk_debugfs_show() SF Markus Elfring
2017-05-08  7:57 ` [PATCH 2/3] block-aoe: Adjust eight checks for null pointers SF Markus Elfring
2017-05-08  7:58 ` [PATCH 3/3] block-aoe: Add spaces for better code readability 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