Renounce Rwlock_LockWrite, Rwlock_LockRead, Rwlock_Unlock

There is no need for these wrappers over the NDIS RW lock
functions.
Add inline function: KFreeSafe

It attempts free only if ptr != NULL.
Added in order to remove duplicated code: remove the need
for the ptr to checked at every KFree call.
Check ptr for arg free / destroy inside the free / destroy funcs

This way we will remove code duplication, where checks are done at every call.
Replace AllocateArguments with KZAlloc

AllocateArguments is a simple wrapper for ExAllocatePoolWithTag.
We don't need that wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace AllocArgument with KZAlloc

AllocArgument is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace AllocArgumentData with KZAlloc

AllocArgumentData is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace FreeArgumentData with KFree

FreeArgumentData is a simple wrapper. We don't need such a specific-named wrapper

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace FreeArgument with KFree

FreeArgument is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace FreeArguments with KFree

FreeArguments is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace AllocArgumentGroup with KZAlloc

AllocArgumentGroup is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace FreeArgGroup with KFree

FreeArgGroup is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace AllocateArgListItem with KZAlloc

AllocateArgListItem is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace FreeArgListItem with KFree

FreeArgListItem is a simple wrapper. We don't need such a wrapper.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Replace ExAllocatePoolWithTag calls with KAlloc

In our driver we use only NonPagedPool. And we use only one pool tag.
Therefore:
1. For consistency (we use the macro KAlloc in other parts of the code)
2. For shorter writing and clarity

It is best to use only KAlloc / KZAlloc.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Fix: Use KFree instead of ExFreePool for pSwitchInfo

pSwitchInfo is allocated with KZAlloc, which uses a pool tag.
Therefore, we need KFree.
Replace ExFreePoolWithTag calls with KFree

In our driver we use only NonPagedPool. And we use only one pool tag.
Therefore:
1. For consistency (we use the macro KFree in other parts of the code)
2. For shorter writing and clarity

It is best to use only KFree.
KFree also checks the pointer before attempting deallocation.
Remove FreeFrameBuffer and FreeNbBufferData

They are simple wrappers for KFree and are not needed.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Cleanup calls to DestroyArgumentGroup

DestroyArgumentGroup now checks if its argument is NULL before attempting
destruction. Therefore, prior checking the pointer is no longer needed
and such checks can now be cleaned up.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Cleanup calls to DestroyArgument

DestroyArgument now checks if its argument is NULL before attempting
destruction. Therefore, prior checking the pointer is no longer needed
and such checks can now be cleaned up.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Cleanup calls to KFree

KFree now checks if its argument is NULL before attempting deallocation.
Therefore, prior checking the pointer is no longer needed.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>