diff --git a/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c b/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c index 270954aaa4094a733e9a95c12818820f8581a851..a8e764e3b9ac2647af4e0f7ff7c955b2489b5cc9 100644 --- a/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c +++ b/drivers/net/ethernet/lantiq/switch-api/gsw_flow_core.c @@ -3153,15 +3153,15 @@ GSW_return_t GSW_MAC_TableClear(void *cdev) ethsw_api_dev_t *gswdev = GSW_PDATA_GET(cdev); u32 ret; -#ifdef __KERNEL__ - spin_lock_bh(&gswdev->lock_pce); -#endif - if (gswdev == NULL) { pr_err("%s:%s:%d", __FILE__, __func__, __LINE__); return GSW_statusErr; } +#ifdef __KERNEL__ + spin_lock_bh(&gswdev->lock_pce); +#endif + /* Flush all entries from the MAC table */ gsw_w32(cdev, PCE_GCTRL_0_MTFL_OFFSET, PCE_GCTRL_0_MTFL_SHIFT, @@ -3244,10 +3244,10 @@ GSW_return_t GSW_MAC_TableEntryAdd(void *cdev, if (gswdev->gipver == LTQ_GSWIP_3_0) { if ((parm->nPortId >= gswdev->tpnum) && - (!(parm->nPortId & 0x80000000))) + (!(parm->nPortId & 0x80000000))) { ret = GSW_statusErr; - - goto UNLOCK_AND_RETURN; + goto UNLOCK_AND_RETURN; + } } memset(&tbl_prog, 0, sizeof(pctbl_prog_t)); @@ -5574,8 +5574,10 @@ GSW_return_t GSW_VLAN_PortMemberAdd(void *cdev, goto UNLOCK_AND_RETURN; } - if (pcindex >= 64) - return GSW_statusValueRange; + if (pcindex >= 64) { + ret = GSW_statusValueRange; + goto UNLOCK_AND_RETURN; + } get_vlan_sw_table(cdev, pcindex, &avlantbl); @@ -5762,6 +5764,7 @@ GSW_return_t GSW_VLAN_PortMemberRemove(void *cdev, if (pcindex == 0xFF) { pr_err("This vid doesn't exists\n"); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } if (pcindex >= 64) { @@ -5831,6 +5834,7 @@ GSW_return_t GSW_VLAN_ReservedAdd(void *cdev, pr_err("ERROR: %s:%s:%d,(VID:%d)\n", __FILE__, __func__, __LINE__, parm->nVId); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } memset(&pcetable, 0, sizeof(pctbl_prog_t)); @@ -5921,6 +5925,7 @@ GSW_return_t GSW_VLAN_ReservedRemove(void *cdev, pr_err("ERROR: %s:%s:%d,(VID:%d)\n", __FILE__, __func__, __LINE__, parm->nVId); ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; } memset(&pcetable, 0, sizeof(pctbl_prog_t)); @@ -6567,7 +6572,7 @@ GSW_return_t GSW_QoS_SVLAN_ClassPCP_PortSet(void *cdev, if (gswdev == NULL) { pr_err("%s:%s:%d", __FILE__, __func__, __LINE__); - ret = GSW_statusErr; + return GSW_statusErr; } #ifdef __KERNEL__ @@ -10925,10 +10930,10 @@ GSW_return_t GSW_MulticastTableEntryAdd(void *cdev, #endif if (IS_VRSN_NOT_31(gswdev->gipver)) { - if (parm->nPortId >= gswdev->tpnum) + if (parm->nPortId >= gswdev->tpnum) { ret = GSW_statusErr; - - goto UNLOCK_AND_RETURN; + goto UNLOCK_AND_RETURN; + } } memset(&ptdata, 0, sizeof(pctbl_prog_t)); @@ -11391,8 +11396,10 @@ GSW_return_t GSW_MulticastTableEntryRemove(void *cdev, #endif if (IS_VRSN_NOT_31(gswdev->gipver)) { - if (parm->nPortId >= gswdev->tpnum) + if (parm->nPortId >= gswdev->tpnum) { ret = GSW_statusErr; + goto UNLOCK_AND_RETURN; + } } memset(&ptdata, 0, sizeof(pctbl_prog_t)); @@ -20215,7 +20222,6 @@ GSW_return_t GSW_ExtendedVlanGet(void *cdev, GSW_EXTENDEDVLAN_config_t *parm) if (ret == GSW_statusErr) { pr_err("%s:%s:%d - GSW_QOS_Dscp2PcpTableGet", __FILE__, __func__, __LINE__); goto UNLOCK_AND_RETURN; - ; } memcpy(parm->sTreatment.nDscp2PcpMap, dscp2pcp_get.nMap, (sizeof(u8) * 64));