Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751982AbcKFMzQ (ORCPT ); Sun, 6 Nov 2016 07:55:16 -0500 Received: from www.osadl.org ([62.245.132.105]:34277 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751724AbcKFMzP (ORCPT ); Sun, 6 Nov 2016 07:55:15 -0500 From: Nicholas Mc Guire To: "Kirill A. Shutemov" Cc: Michal Hocko , George Zhang , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 1/2] VMCI: drop condition with no effect Date: Sun, 6 Nov 2016 13:53:33 +0100 Message-Id: <1478436814-24160-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3064 Lines: 76 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 drivers/misc/vmw_vmci/vmci_queue_pair.c:vmci_qp_broker_detach() 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) { VMCIHost_ReleaseUserMemory(entry->produceQ, entry->consumeQ); } else { VMCIHost_UnregisterUserMemory(entry->produceQ, entry->consumeQ); } 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 driver. 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, result); - 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); } -- 2.1.4