mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Ingo Molnar <mingo@kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/7] VMCI: Delete an unnecessary null pointer check in qp_broker_create()
Date: Wed, 10 Jan 2018 20:28:33 +0100	[thread overview]
Message-ID: <423462ca-25f1-3249-2609-ecfb0da6d987@users.sourceforge.net> (raw)
In-Reply-To: <2747f123-a95d-bc68-b858-0327dce3758b@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 19:00:24 +0100

The exception handling code should usually only be reached with a valid
pointer in the local variable "entry" at the end of this function.
Thus remove an extra null pointer check here.

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

diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 381e25c69c1f..7d4437240099 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -1434,12 +1434,9 @@ static int qp_broker_create(struct vmci_handle handle,
 	return VMCI_SUCCESS;
 
  error:
-	if (entry != NULL) {
-		qp_host_free_queue(entry->produce_q, guest_produce_size);
-		qp_host_free_queue(entry->consume_q, guest_consume_size);
-		kfree(entry);
-	}
-
+	qp_host_free_queue(entry->produce_q, guest_produce_size);
+	qp_host_free_queue(entry->consume_q, guest_consume_size);
+	kfree(entry);
 	return result;
 }
 
-- 
2.15.1

  parent reply	other threads:[~2018-01-10 19:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 19:23 [PATCH 0/7] VMCI: Adjustments for several function implementations SF Markus Elfring
2018-01-10 19:24 ` [PATCH 1/7] VMCI: Delete error messages for a failed memory allocation in seven functions SF Markus Elfring
2018-01-10 19:25 ` [PATCH 2/7] VMCI: Improve a size determination in two functions SF Markus Elfring
2018-01-10 19:27 ` [PATCH 3/7] VMCI: Update a word in five comment lines SF Markus Elfring
2018-01-10 19:28 ` SF Markus Elfring [this message]
2018-01-10 19:29 ` [PATCH 5/7] VMCI: Delete an unnecessary variable initialisation in qp_broker_create() SF Markus Elfring
2018-01-10 19:30 ` [PATCH 6/7] VMCI: Less function calls in qp_broker_create() after error detection SF Markus Elfring
2018-01-10 19:32 ` [PATCH 7/7] VMCI: Adjust 32 checks for null pointers SF Markus Elfring

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=423462ca-25f1-3249-2609-ecfb0da6d987@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yamada.masahiro@socionext.com \
    /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

Powered by JetHome