[ovs-dev] [PATCH 13/14] datapath-windows: Cleanup Vport.c

Alin Gabriel Serdean aserdean at ovn.org
Mon Jul 9 13:40:55 UTC 2018


Do not assign an initial value to ` status`, it will be assigned
later on.

Also, check the result of `status` after `OvsCreateMsgFromVport`.

Signed-off-by: Alin Gabriel Serdean <aserdean at ovn.org>
---
 datapath-windows/ovsext/Vport.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c
index 7cf2497e3..f93c72dc2 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -1448,7 +1448,7 @@ OvsRemoveTunnelVport(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
 NDIS_STATUS
 OvsAddConfiguredSwitchPorts(POVS_SWITCH_CONTEXT switchContext)
 {
-    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
+    NDIS_STATUS status;
     ULONG arrIndex;
     PNDIS_SWITCH_PORT_PARAMETERS portParam;
     PNDIS_SWITCH_PORT_ARRAY portArray = NULL;
@@ -1493,7 +1493,7 @@ cleanup:
 NDIS_STATUS
 OvsInitConfiguredSwitchNics(POVS_SWITCH_CONTEXT switchContext)
 {
-    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
+    NDIS_STATUS status;
     PNDIS_SWITCH_NIC_ARRAY nicArray = NULL;
     ULONG arrIndex;
     PNDIS_SWITCH_NIC_PARAMETERS nicParam;
@@ -2601,7 +2601,10 @@ OvsDeleteVportCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
     status = OvsCreateMsgFromVport(vport, msgIn, usrParamsCtx->outputBuffer,
                                    usrParamsCtx->outputLength,
                                    gOvsSwitchContext->dpNo);
-
+    if (status) {
+        nlError = NlMapStatusToNlErr(status);
+        goto Cleanup;
+    }
     *replyLen = msgOut->nlMsg.nlmsgLen;
 
     /*
-- 
2.16.1.windows.1



More information about the dev mailing list