[ovs-dev,02/14] datapath-windows: Cleanup BufferMgmt.c

Message ID 20180709134056.7060-3-aserdean@ovn.org
State Changes Requested
Headers show
Series
  • Cleanup datapath-windows
Related show

Commit Message

Alin Gabriel Serdean July 9, 2018, 1:40 p.m.
Assign variables directly instead of reassigning them after.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 datapath-windows/ovsext/BufferMgmt.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Shashank Ram July 11, 2018, 10:51 p.m. | #1
On 07/09/2018 06:40 AM, Alin Gabriel Serdean wrote:
> Assign variables directly instead of reassigning them after.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> ---
>   datapath-windows/ovsext/BufferMgmt.c | 14 ++++----------
>   1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c
> index 448cd7652..0f1c705d2 100644
> --- a/datapath-windows/ovsext/BufferMgmt.c
> +++ b/datapath-windows/ovsext/BufferMgmt.c
> @@ -1163,12 +1163,9 @@ FixFragmentHeader(PNET_BUFFER nb, UINT16 fragmentSize,
>                     BOOLEAN lastPacket, UINT16 offset)
>   {
>       EthHdr *dstEth = NULL;
> -    PMDL mdl = NULL;
> -    PUINT8 bufferStart = NULL;
> +    PMDL mdl = NET_BUFFER_FIRST_MDL(nb);
> +    PUINT8 bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
>   
> -    mdl = NET_BUFFER_FIRST_MDL(nb);
> -
> -    bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
>       if (!bufferStart) {
>           return NDIS_STATUS_RESOURCES;
>       }
> @@ -1221,12 +1218,9 @@ FixSegmentHeader(PNET_BUFFER nb, UINT16 segmentSize, UINT32 seqNumber,
>   {
>       EthHdr *dstEth = NULL;
>       TCPHdr *dstTCP = NULL;
> -    PMDL mdl = NULL;
> -    PUINT8 bufferStart = NULL;
> -
> -    mdl = NET_BUFFER_FIRST_MDL(nb);
> +    PMDL mdl = NET_BUFFER_FIRST_MDL(nb);
> +    PUINT8 bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
>   
> -    bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
>       if (!bufferStart) {
>           return NDIS_STATUS_RESOURCES;
>       }

Acked-by: Shashank Ram <rams@vmware.com>

Patch

diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c
index 448cd7652..0f1c705d2 100644
--- a/datapath-windows/ovsext/BufferMgmt.c
+++ b/datapath-windows/ovsext/BufferMgmt.c
@@ -1163,12 +1163,9 @@  FixFragmentHeader(PNET_BUFFER nb, UINT16 fragmentSize,
                   BOOLEAN lastPacket, UINT16 offset)
 {
     EthHdr *dstEth = NULL;
-    PMDL mdl = NULL;
-    PUINT8 bufferStart = NULL;
+    PMDL mdl = NET_BUFFER_FIRST_MDL(nb);
+    PUINT8 bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
 
-    mdl = NET_BUFFER_FIRST_MDL(nb);
-
-    bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
     if (!bufferStart) {
         return NDIS_STATUS_RESOURCES;
     }
@@ -1221,12 +1218,9 @@  FixSegmentHeader(PNET_BUFFER nb, UINT16 segmentSize, UINT32 seqNumber,
 {
     EthHdr *dstEth = NULL;
     TCPHdr *dstTCP = NULL;
-    PMDL mdl = NULL;
-    PUINT8 bufferStart = NULL;
-
-    mdl = NET_BUFFER_FIRST_MDL(nb);
+    PMDL mdl = NET_BUFFER_FIRST_MDL(nb);
+    PUINT8 bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
 
-    bufferStart = (PUINT8)OvsGetMdlWithLowPriority(mdl);
     if (!bufferStart) {
         return NDIS_STATUS_RESOURCES;
     }