From: VMware, Inc <> Date: Sat, 28 May 2011 19:08:29 +0000 (-0700) Subject: Make vmci linux module not have unused but set variables. X-Git-Tag: 2011.05.27-420096~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ada5e3e4d98c9b71702ec97db77dd75940f417f9;p=thirdparty%2Fopen-vm-tools.git Make vmci linux module not have unused but set variables. Fedora 15 compiles modules with the -Wunused-but-set-variable flag. This exposed some cases, where the VMCI code would set variables without using them. Fix those. Note that the unused annotation only means potentially unused. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h index bf36d52df..3128c6b5a 100644 --- a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h +++ b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h @@ -414,7 +414,7 @@ Bool VMCI_HostPersonalityActive(void); # define VMCIList_InitEntry(_e) List_InitElement(_e) # define VMCIList_Empty(_l) List_IsEmpty(_l) # define VMCIList_Insert(_e, _l) List_Insert(_e, LIST_ATREAR(_l)) -# define VMCIList_Remove(_e, _l) List_Remove(_e) +# define VMCIList_Remove(_e) List_Remove(_e) # define VMCIList_Scan(_cur, _l) LIST_FORALL(_l, _cur) # define VMCIList_ScanSafe(_cur, _next, _l) LIST_FORALL_SAFE(_l, _cur, _next) # define VMCIList_Entry(_elem, _type, _field) List_Entry(_elem, _type, _field) @@ -427,7 +427,7 @@ Bool VMCI_HostPersonalityActive(void); # define VMCIList_InitEntry(_e) DblLnkLst_Init(_e) # define VMCIList_Empty(_l) (!DblLnkLst_IsLinked(_l)) # define VMCIList_Insert(_e, _l) DblLnkLst_LinkLast(_l, _e) -# define VMCIList_Remove(_e, _l) DblLnkLst_Unlink1(_e) +# define VMCIList_Remove(_e) DblLnkLst_Unlink1(_e) # define VMCIList_Scan(_cur, _l) DblLnkLst_ForEach(_cur, _l) # define VMCIList_ScanSafe(_cur, _next, _l) DblLnkLst_ForEachSafe(_cur, _next, _l) # define VMCIList_Entry(_elem, _type, _field) DblLnkLst_Container(_elem, _type, _field) diff --git a/open-vm-tools/modules/linux/vmci/common/vmciContext.c b/open-vm-tools/modules/linux/vmci/common/vmciContext.c index e36e32e5f..74aa29321 100644 --- a/open-vm-tools/modules/linux/vmci/common/vmciContext.c +++ b/open-vm-tools/modules/linux/vmci/common/vmciContext.c @@ -443,7 +443,7 @@ VMCIContext_ReleaseContext(VMCIContext *context) // IN /* Dequeue VMCI context. */ VMCI_GrabLock(&contextList.lock, &flags); - VMCIList_Remove(&context->listItem, &contextList.head); + VMCIList_Remove(&context->listItem); VMCI_ReleaseLock(&contextList.lock, flags); VMCIContext_Release(context); @@ -533,7 +533,7 @@ VMCIContextFreeContext(VMCIContext *context) // IN VMCIList_ScanSafe(curr, next, &context->datagramQueue) { dqEntry = VMCIList_Entry(curr, DatagramQueueEntry, listItem); - VMCIList_Remove(curr, &context->datagramQueue); + VMCIList_Remove(curr); ASSERT(dqEntry && dqEntry->dg); ASSERT(dqEntry->dgSize == VMCI_DG_SIZE(dqEntry->dg)); VMCI_FreeKernelMem(dqEntry->dg, dqEntry->dgSize); @@ -923,7 +923,7 @@ VMCIContext_DequeueDatagram(VMCIContext *context, // IN return VMCI_ERROR_NO_MEM; } - VMCIList_Remove(listItem, &context->datagramQueue); + VMCIList_Remove(listItem); context->pendingDatagrams--; context->datagramQueueSize -= dqEntry->dgSize; if (context->pendingDatagrams == 0) { diff --git a/open-vm-tools/modules/linux/vmci/common/vmciDoorbell.c b/open-vm-tools/modules/linux/vmci/common/vmciDoorbell.c index 6c2e2c5db..0fde37df8 100644 --- a/open-vm-tools/modules/linux/vmci/common/vmciDoorbell.c +++ b/open-vm-tools/modules/linux/vmci/common/vmciDoorbell.c @@ -412,7 +412,6 @@ VMCIDoorbellIndexTableAdd(VMCIDoorbellEntry *entry) // IN/OUT static void VMCIDoorbellIndexTableRemove(VMCIDoorbellEntry *entry) // IN/OUT { - uint32 bucket; VMCILockFlags flags; ASSERT(entry); @@ -420,8 +419,7 @@ VMCIDoorbellIndexTableRemove(VMCIDoorbellEntry *entry) // IN/OUT VMCIDoorbellGrabLock(&vmciDoorbellIT.lock, &flags); - bucket = VMCI_DOORBELL_HASH(entry->idx); - VMCIList_Remove(&entry->idxListItem, &vmciDoorbellIT.entries[bucket]); + VMCIList_Remove(&entry->idxListItem); notifyIdxCount--; if (entry->idx == maxNotifyIdx - 1) { diff --git a/open-vm-tools/modules/linux/vmci/common/vmciEvent.c b/open-vm-tools/modules/linux/vmci/common/vmciEvent.c index fbd397976..73161c18d 100644 --- a/open-vm-tools/modules/linux/vmci/common/vmciEvent.c +++ b/open-vm-tools/modules/linux/vmci/common/vmciEvent.c @@ -631,7 +631,7 @@ VMCIEventUnregisterSubscription(VMCIId subID) // IN s = VMCIEventFind(subID); if (s != NULL) { VMCIEventRelease(s); - VMCIList_Remove(&s->subscriberListItem, &subscriberArray[s->event]); + VMCIList_Remove(&s->subscriberListItem); } VMCIEventReleaseLock(&subscriberLock, flags); diff --git a/open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c b/open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c index a01b6ea6d..96b7dede5 100644 --- a/open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c +++ b/open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c @@ -438,7 +438,7 @@ QueuePairList_RemoveEntry(QueuePairList *qpList, // IN QueuePairEntry *entry) // IN { if (entry) { - VMCIList_Remove(&entry->listItem, &qpBrokerList.head); + VMCIList_Remove(&entry->listItem); } } @@ -2485,10 +2485,10 @@ VMCIQPGuestEndpoints_Convert(Bool toLocal, // IN listItem); if (!(entry->qp.flags & VMCI_QPFLAG_LOCAL)) { - VMCIQueue *prodQ; - VMCIQueue *consQ; + UNUSED_PARAM(VMCIQueue *prodQ); // Only used on Win32 + UNUSED_PARAM(VMCIQueue *consQ); // Only used on Win32 void *oldProdQ; - void *oldConsQ; + UNUSED_PARAM(void *oldConsQ); // Only used on Win32 int result; prodQ = (VMCIQueue *)entry->produceQ; diff --git a/open-vm-tools/modules/linux/vmci/linux/driver.c b/open-vm-tools/modules/linux/vmci/linux/driver.c index 12b428387..a64b5e729 100644 --- a/open-vm-tools/modules/linux/vmci/linux/driver.c +++ b/open-vm-tools/modules/linux/vmci/linux/driver.c @@ -489,10 +489,7 @@ LinuxDriver_Close(struct inode *inode, // IN ASSERT(vmciLinux); if (vmciLinux->ctType == VMCIOBJ_CONTEXT) { - VMCIId cid; - ASSERT(vmciLinux->context); - cid = VMCIContext_GetId(vmciLinux->context); VMCIContext_ReleaseContext(vmciLinux->context); vmciLinux->context = NULL;