linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: user-mode-linux-devel@lists.sourceforge.net,
	user-mode-linux-user@lists.sourceforge.net,
	Anton Ivanov <aivanov@kot-begemot.co.uk>,
	Dan Williams <dan.j.williams@intel.com>,
	Hannes Reinecke <hare@suse.com>, Jeff Dike <jdike@addtoit.com>,
	Jens Axboe <axboe@fb.com>, Richard Weinberger <richard@nod.at>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Subject: [PATCH 2/5] um: port: Delete three error messages for a failed memory allocation
Date: Wed, 18 Jan 2017 22:57:30 +0100	[thread overview]
Message-ID: <651ecf90-9c68-aec1-58d7-d11e7671ed4c@users.sourceforge.net> (raw)
In-Reply-To: <c10b7f33-f573-aa9f-239e-ccca5540f264@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Jan 2017 22:00:14 +0100

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

WARNING: Possible unnecessary 'out of memory' message

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/um/drivers/port_kern.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c
index b2bbda21c5f3..c96741e920f5 100644
--- a/arch/um/drivers/port_kern.c
+++ b/arch/um/drivers/port_kern.c
@@ -87,11 +87,8 @@ static int port_accept(struct port_list *port)
 	}
 
 	conn = kmalloc(sizeof(*conn), GFP_ATOMIC);
-	if (conn == NULL) {
-		printk(KERN_ERR "port_accept : failed to allocate "
-		       "connection\n");
+	if (!conn)
 		goto out_close;
-	}
 	*conn = ((struct connection)
 		{ .list 	= LIST_HEAD_INIT(conn->list),
 		  .fd 		= fd,
@@ -170,10 +167,8 @@ void *port_data(int port_num)
 			goto found;
 	}
 	port = kmalloc(sizeof(struct port_list), GFP_KERNEL);
-	if (port == NULL) {
-		printk(KERN_ERR "Allocation of port list failed\n");
+	if (!port)
 		goto out;
-	}
 
 	fd = port_listen_fd(port_num);
 	if (fd < 0) {
@@ -202,10 +197,8 @@ void *port_data(int port_num)
 
  found:
 	dev = kmalloc(sizeof(struct port_dev), GFP_KERNEL);
-	if (dev == NULL) {
-		printk(KERN_ERR "Allocation of port device entry failed\n");
+	if (!dev)
 		goto out;
-	}
 
 	*dev = ((struct port_dev) { .port  		= port,
 				    .helper_pid  	= -1,
-- 
2.11.0



  parent reply	other threads:[~2017-01-18 21:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 21:55 [PATCH 0/5] UM: Fine-tuning for some function implementations SF Markus Elfring
2017-01-18 21:56 ` [PATCH 1/5] um: port: Move an assignment for the variable "fd" in port_wait() SF Markus Elfring
2017-01-19  0:03   ` Jeff Dike
2017-01-18 21:57 ` SF Markus Elfring [this message]
2017-01-19  0:07   ` [PATCH 2/5] um: port: Delete three error messages for a failed memory allocation Jeff Dike
2017-01-19  9:38     ` SF Markus Elfring
2017-01-18 21:58 ` [PATCH 3/5] um: port: Improve size determinations in port_data() SF Markus Elfring
2017-01-18 21:59 ` [PATCH 4/5] um: ubd: Move two assignments for the variable "err" in ubd_remove() SF Markus Elfring
2017-01-18 22:00 ` [PATCH 5/5] um: ubd: Improve size determinations in do_ubd_request() SF Markus Elfring
2017-01-19  7:56 ` [PATCH 0/5] UM: Fine-tuning for some function implementations Richard Weinberger
2017-01-19 17:13   ` SF Markus Elfring
2017-01-19 18:44     ` Anton Ivanov
2017-01-20  5:11   ` [PATCH 0/5] " Jeff Dike

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=651ecf90-9c68-aec1-58d7-d11e7671ed4c@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=aivanov@kot-begemot.co.uk \
    --cc=axboe@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hare@suse.com \
    --cc=jdike@addtoit.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=user-mode-linux-user@lists.sourceforge.net \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).