Signed-off-by: Matthias Beyer <m...@beyermatthias.de>
---
 drivers/staging/bcm/PHSModule.c | 66 +++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 7ced228..4e6bcef 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -639,49 +639,51 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 
uiVcid)
        BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
                        "====>\n");
 
-       if (pDeviceExtension) {
-               /* Retrieve the SFID Entry Index for requested Service Flow */
-               nSFIndex = 
GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
-                                              uiVcid, &pstServiceFlowEntry);
-               if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
-                       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
-                                       DBG_LVL_ALL, "SFID Match Failed\n");
-                       return ERR_SF_MATCH_FAIL;
-               }
+       if (!pDeviceExtension)
+               goto out;
 
-               pstClassifierRulesTable = 
pstServiceFlowEntry->pstClassifierTable;
-               if (pstClassifierRulesTable) {
-                       for (nClsidIndex = 0; nClsidIndex < MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
-                               if 
(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) {
+       /* Retrieve the SFID Entry Index for requested Service Flow */
+       nSFIndex = 
GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
+                                      uiVcid, &pstServiceFlowEntry);
+       if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
+               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
+                               DBG_LVL_ALL, "SFID Match Failed\n");
+               return ERR_SF_MATCH_FAIL;
+       }
 
-                                       if 
(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
-                                               
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
+       pstClassifierRulesTable = pstServiceFlowEntry->pstClassifierTable;
+       if (pstClassifierRulesTable) {
+               for (nClsidIndex = 0; nClsidIndex < MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
+                       if 
(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) {
 
-                                       if (0 == 
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
-                                               
kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
+                               if 
(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
+                                       
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
 
-                                       
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL;
-                               }
-                               
memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex],
-                                      0, sizeof(struct 
bcm_phs_classifier_entry));
-                               if 
(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) {
+                               if (0 == 
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
+                                       
kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
+
+                               
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL;
+                       }
+                       
memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex],
+                              0, sizeof(struct bcm_phs_classifier_entry));
+                       if 
(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) {
 
-                                       if 
(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
-                                               
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
+                               if 
(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
+                                       
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
 
-                                       if (0 == 
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
-                                               
kfree(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule);
+                               if (0 == 
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
+                                       
kfree(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule);
 
-                                       
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule = NULL;
-                               }
-                               
memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex],
-                                      0, sizeof(struct 
bcm_phs_classifier_entry));
+                               
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule = NULL;
                        }
+                       
memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex],
+                              0, sizeof(struct bcm_phs_classifier_entry));
                }
-               pstServiceFlowEntry->bUsed = false;
-               pstServiceFlowEntry->uiVcid = 0;
        }
+       pstServiceFlowEntry->bUsed = false;
+       pstServiceFlowEntry->uiVcid = 0;
 
+out:
        return 0;
 }
 
-- 
2.0.1

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to