All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] paride: Delete an error message for a failed memory allocation in two functions
@ 2017-08-07  9:23 ` SF Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: SF Markus Elfring @ 2017-08-07  9:23 UTC (permalink / raw)
  To: Tim Waugh, kernel-janitors; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 7 Aug 2017 11:11:34 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/block/paride/pg.c | 1 -
 drivers/block/paride/pt.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 3b5882bfb736..9b036c79c49e 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -550,7 +550,6 @@ static int pg_open(struct inode *inode, struct file *file)
 	dev->bufptr = kmalloc(PG_MAX_DATA, GFP_KERNEL);
 	if (dev->bufptr == NULL) {
 		clear_bit(0, &dev->access);
-		printk("%s: buffer allocation failed\n", dev->name);
 		ret = -ENOMEM;
 		goto out;
 	}
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index e815312a00ad..33347853b7d4 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -687,10 +687,8 @@ static int pt_open(struct inode *inode, struct file *file)
 
 	err = -ENOMEM;
 	tape->bufptr = kmalloc(PT_BUFSIZE, GFP_KERNEL);
-	if (tape->bufptr == NULL) {
-		printk("%s: buffer allocation failed\n", tape->name);
+	if (!tape->bufptr)
 		goto out;
-	}
 
 	file->private_data = tape;
 	mutex_unlock(&pt_mutex);
-- 
2.13.4

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

* [PATCH] paride: Delete an error message for a failed memory allocation in two functions
@ 2017-08-07  9:23 ` SF Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: SF Markus Elfring @ 2017-08-07  9:23 UTC (permalink / raw)
  To: Tim Waugh, kernel-janitors; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 7 Aug 2017 11:11:34 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/block/paride/pg.c | 1 -
 drivers/block/paride/pt.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 3b5882bfb736..9b036c79c49e 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -550,7 +550,6 @@ static int pg_open(struct inode *inode, struct file *file)
 	dev->bufptr = kmalloc(PG_MAX_DATA, GFP_KERNEL);
 	if (dev->bufptr = NULL) {
 		clear_bit(0, &dev->access);
-		printk("%s: buffer allocation failed\n", dev->name);
 		ret = -ENOMEM;
 		goto out;
 	}
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index e815312a00ad..33347853b7d4 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -687,10 +687,8 @@ static int pt_open(struct inode *inode, struct file *file)
 
 	err = -ENOMEM;
 	tape->bufptr = kmalloc(PT_BUFSIZE, GFP_KERNEL);
-	if (tape->bufptr = NULL) {
-		printk("%s: buffer allocation failed\n", tape->name);
+	if (!tape->bufptr)
 		goto out;
-	}
 
 	file->private_data = tape;
 	mutex_unlock(&pt_mutex);
-- 
2.13.4


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

end of thread, other threads:[~2017-08-07  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07  9:23 [PATCH] paride: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-08-07  9:23 ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.