[lkml]   [2016]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 1/2] VMCI: drop condition with no effect
The condition calls the same code, further the code called does not 
differentiate between old/new-style VMX anyway so the if/else here
is simply not needed.

Fixes: 06164d2b72aa ("VMCI: queue pairs implementation.")
Signed-off-by: Nicholas Mc Guire <>

problem found by coccinelle

2232 if (entry->vmci_page_files)
2233 qp_host_unregister_user_memory(entry->produce_q,
2234 entry->
2235 consume_q);
2236 else
2237 qp_host_unregister_user_memory(entry->produce_q,
2238 entry->
2239 consume_q);

The original driver code was calling:
if (entry->vmciPageFiles) {
} else {
but the VMCIHost_ReleaseUserMemory equivalent function seems to not
have ever existed in the mainline Linus version of the driver so the
differentiation no longer is needed.

The difference handled by setting vmci_page_files is old-style and
new-style VMX but the qp_host_unregister_user_memory and the there
called qp_release_pages() are not differentiating between old and
new style VMX so it does not seem to be a missing parameter and
from the documentation it seems that the unregister function is to
be called after unmapping - so this if/else here seems to make no
sense - from code review I suspect it can be dropped but this would
need confirmation by someone that understands the details of the

The documentation at the top of the file also seems to be a bit out of
date/inconsistent with respect to old-style/new-style VMX (or Im just
not understanding it).

Patch was compile checked with: x86_64_defconfig + CONFIG_VMWARE_VMCI=m

Patch is against 4.9.0-rc2 (localversion-next is next-20161028)

drivers/misc/vmw_vmci/vmci_queue_pair.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index f84a427..6f6069c 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -2229,14 +2229,8 @@ int vmci_qp_broker_detach(struct vmci_handle handle, struct vmci_ctx *context)
handle.context, handle.resource,

- if (entry->vmci_page_files)
- qp_host_unregister_user_memory(entry->produce_q,
- entry->
- consume_q);
- else
- qp_host_unregister_user_memory(entry->produce_q,
- entry->
- consume_q);
+ qp_host_unregister_user_memory(entry->produce_q,
+ entry->consume_q);


 \ /
  Last update: 2016-11-06 13:55    [W:0.156 / U:0.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site