Commit ba574696 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

ucc_geth: Cleanup repetitive ucc_geth_memclean() calls

No need to call ucc_geth_memclean() so many times, just check for
errors in ucc_geth_open(), and call ucc_geth_stop() in case of errors.

The ucc_geth_stop() may be called anytime and will do the right thing.
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67c2fb8f
...@@ -2420,7 +2420,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2420,7 +2420,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
if (ucc_fast_init(uf_info, &ugeth->uccf)) { if (ucc_fast_init(uf_info, &ugeth->uccf)) {
if (netif_msg_probe(ugeth)) if (netif_msg_probe(ugeth))
ugeth_err("%s: Failed to init uccf.", __func__); ugeth_err("%s: Failed to init uccf.", __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2476,7 +2475,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2476,7 +2475,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Bad number of Rx threads value.", ugeth_err("%s: Bad number of Rx threads value.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
break; break;
} }
...@@ -2501,7 +2499,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2501,7 +2499,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Bad number of Tx threads value.", ugeth_err("%s: Bad number of Tx threads value.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
break; break;
} }
...@@ -2555,7 +2552,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2555,7 +2552,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: IPGIFG initialization parameter too large.", ugeth_err("%s: IPGIFG initialization parameter too large.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return ret_val; return ret_val;
} }
...@@ -2573,7 +2569,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2573,7 +2569,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Half Duplex initialization parameter too large.", ugeth_err("%s: Half Duplex initialization parameter too large.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return ret_val; return ret_val;
} }
...@@ -2628,7 +2623,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2628,7 +2623,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate memory for Tx bd rings.", ("%s: Can not allocate memory for Tx bd rings.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
/* Zero unused end of bd ring, according to spec */ /* Zero unused end of bd ring, according to spec */
...@@ -2664,7 +2658,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2664,7 +2658,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate memory for Rx bd rings.", ("%s: Can not allocate memory for Rx bd rings.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
} }
...@@ -2680,7 +2673,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2680,7 +2673,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Could not allocate tx_skbuff", ugeth_err("%s: Could not allocate tx_skbuff",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2712,7 +2704,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2712,7 +2704,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Could not allocate rx_skbuff", ugeth_err("%s: Could not allocate rx_skbuff",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2746,7 +2737,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2746,7 +2737,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
ugeth->p_tx_glbl_pram = ugeth->p_tx_glbl_pram =
...@@ -2769,7 +2759,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2769,7 +2759,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_tx.", ("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2799,7 +2788,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2799,7 +2788,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2843,7 +2831,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2843,7 +2831,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_scheduler.", ("%s: Can not allocate DPRAM memory for p_scheduler.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2894,7 +2881,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2894,7 +2881,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_tx_fw_statistics_pram.", " p_tx_fw_statistics_pram.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
ugeth->p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram =
...@@ -2934,7 +2920,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2934,7 +2920,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
ugeth->p_rx_glbl_pram = ugeth->p_rx_glbl_pram =
...@@ -2956,7 +2941,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2956,7 +2941,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_rx.", ("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2980,7 +2964,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2980,7 +2964,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_rx_fw_statistics_pram.", __func__); " p_rx_fw_statistics_pram.", __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
ugeth->p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram =
...@@ -3003,7 +2986,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3003,7 +2986,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_rx_irq_coalescing_tbl.", __func__); " p_rx_irq_coalescing_tbl.", __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3072,7 +3054,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3072,7 +3054,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3149,7 +3130,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3149,7 +3130,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Null Extended Filtering Chain Pointer.", ugeth_err("%s: Null Extended Filtering Chain Pointer.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
} }
...@@ -3163,7 +3143,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3163,7 +3143,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_exf_glbl_param.", __func__); " p_exf_glbl_param.", __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3211,7 +3190,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3211,7 +3190,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate memory for" ("%s: Can not allocate memory for"
" p_UccInitEnetParamShadows.", __func__); " p_UccInitEnetParamShadows.", __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
/* Zero out *p_init_enet_param_shadow */ /* Zero out *p_init_enet_param_shadow */
...@@ -3246,7 +3224,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3246,7 +3224,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Invalid largest External Lookup Key Size.", ugeth_err("%s: Invalid largest External Lookup Key Size.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
} }
ugeth->p_init_enet_param_shadow->largestexternallookupkeysize = ugeth->p_init_enet_param_shadow->largestexternallookupkeysize =
...@@ -3273,7 +3250,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3273,7 +3250,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill p_init_enet_param_shadow.", ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return ret_val; return ret_val;
} }
...@@ -3289,7 +3265,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3289,7 +3265,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill p_init_enet_param_shadow.", ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return ret_val; return ret_val;
} }
...@@ -3299,7 +3274,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3299,7 +3274,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill Rx bds with buffers.", ugeth_err("%s: Can not fill Rx bds with buffers.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return ret_val; return ret_val;
} }
} }
...@@ -3311,7 +3285,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3311,7 +3285,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_init_enet_pram.", ("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
__func__); __func__);
ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
p_init_enet_pram = p_init_enet_pram =
...@@ -3761,7 +3734,6 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3761,7 +3734,6 @@ static int ucc_geth_open(struct net_device *dev)
if (err) { if (err) {
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot enable net device, aborting.", dev->name); ugeth_err("%s: Cannot enable net device, aborting.", dev->name);
ucc_geth_stop(ugeth);
goto out_err; goto out_err;
} }
...@@ -3771,7 +3743,6 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3771,7 +3743,6 @@ static int ucc_geth_open(struct net_device *dev)
if (netif_msg_ifup(ugeth)) if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot get IRQ for net device, aborting.", ugeth_err("%s: Cannot get IRQ for net device, aborting.",
dev->name); dev->name);
ucc_geth_stop(ugeth);
goto out_err; goto out_err;
} }
...@@ -3781,7 +3752,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3781,7 +3752,7 @@ static int ucc_geth_open(struct net_device *dev)
out_err: out_err:
napi_disable(&ugeth->napi); napi_disable(&ugeth->napi);
ucc_geth_stop(ugeth);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment