aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-12-18 03:23:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-19 01:50:52 -0500
commitba574696a34eb518979e742b35ccd30dec284583 (patch)
tree916dc12340b8599ea1d516977bab99158d57a6fe /drivers/net/ucc_geth.c
parent67c2fb8ff0eda3cee95954a1dd245c3ce1a10486 (diff)
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: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 3d1966c34d29..052ad71365de 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2420,7 +2420,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2420 if (ucc_fast_init(uf_info, &ugeth->uccf)) { 2420 if (ucc_fast_init(uf_info, &ugeth->uccf)) {
2421 if (netif_msg_probe(ugeth)) 2421 if (netif_msg_probe(ugeth))
2422 ugeth_err("%s: Failed to init uccf.", __func__); 2422 ugeth_err("%s: Failed to init uccf.", __func__);
2423 ucc_geth_memclean(ugeth);
2424 return -ENOMEM; 2423 return -ENOMEM;
2425 } 2424 }
2426 2425
@@ -2476,7 +2475,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2476 if (netif_msg_ifup(ugeth)) 2475 if (netif_msg_ifup(ugeth))
2477 ugeth_err("%s: Bad number of Rx threads value.", 2476 ugeth_err("%s: Bad number of Rx threads value.",
2478 __func__); 2477 __func__);
2479 ucc_geth_memclean(ugeth);
2480 return -EINVAL; 2478 return -EINVAL;
2481 break; 2479 break;
2482 } 2480 }
@@ -2501,7 +2499,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2501 if (netif_msg_ifup(ugeth)) 2499 if (netif_msg_ifup(ugeth))
2502 ugeth_err("%s: Bad number of Tx threads value.", 2500 ugeth_err("%s: Bad number of Tx threads value.",
2503 __func__); 2501 __func__);
2504 ucc_geth_memclean(ugeth);
2505 return -EINVAL; 2502 return -EINVAL;
2506 break; 2503 break;
2507 } 2504 }
@@ -2555,7 +2552,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2555 if (netif_msg_ifup(ugeth)) 2552 if (netif_msg_ifup(ugeth))
2556 ugeth_err("%s: IPGIFG initialization parameter too large.", 2553 ugeth_err("%s: IPGIFG initialization parameter too large.",
2557 __func__); 2554 __func__);
2558 ucc_geth_memclean(ugeth);
2559 return ret_val; 2555 return ret_val;
2560 } 2556 }
2561 2557
@@ -2573,7 +2569,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2573 if (netif_msg_ifup(ugeth)) 2569 if (netif_msg_ifup(ugeth))
2574 ugeth_err("%s: Half Duplex initialization parameter too large.", 2570 ugeth_err("%s: Half Duplex initialization parameter too large.",
2575 __func__); 2571 __func__);
2576 ucc_geth_memclean(ugeth);
2577 return ret_val; 2572 return ret_val;
2578 } 2573 }
2579 2574
@@ -2628,7 +2623,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2628 ugeth_err 2623 ugeth_err
2629 ("%s: Can not allocate memory for Tx bd rings.", 2624 ("%s: Can not allocate memory for Tx bd rings.",
2630 __func__); 2625 __func__);
2631 ucc_geth_memclean(ugeth);
2632 return -ENOMEM; 2626 return -ENOMEM;
2633 } 2627 }
2634 /* Zero unused end of bd ring, according to spec */ 2628 /* Zero unused end of bd ring, according to spec */
@@ -2664,7 +2658,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2664 ugeth_err 2658 ugeth_err
2665 ("%s: Can not allocate memory for Rx bd rings.", 2659 ("%s: Can not allocate memory for Rx bd rings.",
2666 __func__); 2660 __func__);
2667 ucc_geth_memclean(ugeth);
2668 return -ENOMEM; 2661 return -ENOMEM;
2669 } 2662 }
2670 } 2663 }
@@ -2680,7 +2673,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2680 if (netif_msg_ifup(ugeth)) 2673 if (netif_msg_ifup(ugeth))
2681 ugeth_err("%s: Could not allocate tx_skbuff", 2674 ugeth_err("%s: Could not allocate tx_skbuff",
2682 __func__); 2675 __func__);
2683 ucc_geth_memclean(ugeth);
2684 return -ENOMEM; 2676 return -ENOMEM;
2685 } 2677 }
2686 2678
@@ -2712,7 +2704,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2712 if (netif_msg_ifup(ugeth)) 2704 if (netif_msg_ifup(ugeth))
2713 ugeth_err("%s: Could not allocate rx_skbuff", 2705 ugeth_err("%s: Could not allocate rx_skbuff",
2714 __func__); 2706 __func__);
2715 ucc_geth_memclean(ugeth);
2716 return -ENOMEM; 2707 return -ENOMEM;
2717 } 2708 }
2718 2709
@@ -2746,7 +2737,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2746 ugeth_err 2737 ugeth_err
2747 ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", 2738 ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
2748 __func__); 2739 __func__);
2749 ucc_geth_memclean(ugeth);
2750 return -ENOMEM; 2740 return -ENOMEM;
2751 } 2741 }
2752 ugeth->p_tx_glbl_pram = 2742 ugeth->p_tx_glbl_pram =
@@ -2769,7 +2759,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2769 ugeth_err 2759 ugeth_err
2770 ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", 2760 ("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
2771 __func__); 2761 __func__);
2772 ucc_geth_memclean(ugeth);
2773 return -ENOMEM; 2762 return -ENOMEM;
2774 } 2763 }
2775 2764
@@ -2799,7 +2788,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2799 ugeth_err 2788 ugeth_err
2800 ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", 2789 ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
2801 __func__); 2790 __func__);
2802 ucc_geth_memclean(ugeth);
2803 return -ENOMEM; 2791 return -ENOMEM;
2804 } 2792 }
2805 2793
@@ -2843,7 +2831,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2843 ugeth_err 2831 ugeth_err
2844 ("%s: Can not allocate DPRAM memory for p_scheduler.", 2832 ("%s: Can not allocate DPRAM memory for p_scheduler.",
2845 __func__); 2833 __func__);
2846 ucc_geth_memclean(ugeth);
2847 return -ENOMEM; 2834 return -ENOMEM;
2848 } 2835 }
2849 2836
@@ -2894,7 +2881,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2894 ("%s: Can not allocate DPRAM memory for" 2881 ("%s: Can not allocate DPRAM memory for"
2895 " p_tx_fw_statistics_pram.", 2882 " p_tx_fw_statistics_pram.",
2896 __func__); 2883 __func__);
2897 ucc_geth_memclean(ugeth);
2898 return -ENOMEM; 2884 return -ENOMEM;
2899 } 2885 }
2900 ugeth->p_tx_fw_statistics_pram = 2886 ugeth->p_tx_fw_statistics_pram =
@@ -2934,7 +2920,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2934 ugeth_err 2920 ugeth_err
2935 ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", 2921 ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
2936 __func__); 2922 __func__);
2937 ucc_geth_memclean(ugeth);
2938 return -ENOMEM; 2923 return -ENOMEM;
2939 } 2924 }
2940 ugeth->p_rx_glbl_pram = 2925 ugeth->p_rx_glbl_pram =
@@ -2956,7 +2941,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2956 ugeth_err 2941 ugeth_err
2957 ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", 2942 ("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
2958 __func__); 2943 __func__);
2959 ucc_geth_memclean(ugeth);
2960 return -ENOMEM; 2944 return -ENOMEM;
2961 } 2945 }
2962 2946
@@ -2980,7 +2964,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2980 ugeth_err 2964 ugeth_err
2981 ("%s: Can not allocate DPRAM memory for" 2965 ("%s: Can not allocate DPRAM memory for"
2982 " p_rx_fw_statistics_pram.", __func__); 2966 " p_rx_fw_statistics_pram.", __func__);
2983 ucc_geth_memclean(ugeth);
2984 return -ENOMEM; 2967 return -ENOMEM;
2985 } 2968 }
2986 ugeth->p_rx_fw_statistics_pram = 2969 ugeth->p_rx_fw_statistics_pram =
@@ -3003,7 +2986,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3003 ugeth_err 2986 ugeth_err
3004 ("%s: Can not allocate DPRAM memory for" 2987 ("%s: Can not allocate DPRAM memory for"
3005 " p_rx_irq_coalescing_tbl.", __func__); 2988 " p_rx_irq_coalescing_tbl.", __func__);
3006 ucc_geth_memclean(ugeth);
3007 return -ENOMEM; 2989 return -ENOMEM;
3008 } 2990 }
3009 2991
@@ -3072,7 +3054,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3072 ugeth_err 3054 ugeth_err
3073 ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", 3055 ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
3074 __func__); 3056 __func__);
3075 ucc_geth_memclean(ugeth);
3076 return -ENOMEM; 3057 return -ENOMEM;
3077 } 3058 }
3078 3059
@@ -3149,7 +3130,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3149 if (netif_msg_ifup(ugeth)) 3130 if (netif_msg_ifup(ugeth))
3150 ugeth_err("%s: Null Extended Filtering Chain Pointer.", 3131 ugeth_err("%s: Null Extended Filtering Chain Pointer.",
3151 __func__); 3132 __func__);
3152 ucc_geth_memclean(ugeth);
3153 return -EINVAL; 3133 return -EINVAL;
3154 } 3134 }
3155 3135
@@ -3163,7 +3143,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3163 ugeth_err 3143 ugeth_err
3164 ("%s: Can not allocate DPRAM memory for" 3144 ("%s: Can not allocate DPRAM memory for"
3165 " p_exf_glbl_param.", __func__); 3145 " p_exf_glbl_param.", __func__);
3166 ucc_geth_memclean(ugeth);
3167 return -ENOMEM; 3146 return -ENOMEM;
3168 } 3147 }
3169 3148
@@ -3211,7 +3190,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3211 ugeth_err 3190 ugeth_err
3212 ("%s: Can not allocate memory for" 3191 ("%s: Can not allocate memory for"
3213 " p_UccInitEnetParamShadows.", __func__); 3192 " p_UccInitEnetParamShadows.", __func__);
3214 ucc_geth_memclean(ugeth);
3215 return -ENOMEM; 3193 return -ENOMEM;
3216 } 3194 }
3217 /* Zero out *p_init_enet_param_shadow */ 3195 /* Zero out *p_init_enet_param_shadow */
@@ -3246,7 +3224,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3246 if (netif_msg_ifup(ugeth)) 3224 if (netif_msg_ifup(ugeth))
3247 ugeth_err("%s: Invalid largest External Lookup Key Size.", 3225 ugeth_err("%s: Invalid largest External Lookup Key Size.",
3248 __func__); 3226 __func__);
3249 ucc_geth_memclean(ugeth);
3250 return -EINVAL; 3227 return -EINVAL;
3251 } 3228 }
3252 ugeth->p_init_enet_param_shadow->largestexternallookupkeysize = 3229 ugeth->p_init_enet_param_shadow->largestexternallookupkeysize =
@@ -3273,7 +3250,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3273 if (netif_msg_ifup(ugeth)) 3250 if (netif_msg_ifup(ugeth))
3274 ugeth_err("%s: Can not fill p_init_enet_param_shadow.", 3251 ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
3275 __func__); 3252 __func__);
3276 ucc_geth_memclean(ugeth);
3277 return ret_val; 3253 return ret_val;
3278 } 3254 }
3279 3255
@@ -3289,7 +3265,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3289 if (netif_msg_ifup(ugeth)) 3265 if (netif_msg_ifup(ugeth))
3290 ugeth_err("%s: Can not fill p_init_enet_param_shadow.", 3266 ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
3291 __func__); 3267 __func__);
3292 ucc_geth_memclean(ugeth);
3293 return ret_val; 3268 return ret_val;
3294 } 3269 }
3295 3270
@@ -3299,7 +3274,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3299 if (netif_msg_ifup(ugeth)) 3274 if (netif_msg_ifup(ugeth))
3300 ugeth_err("%s: Can not fill Rx bds with buffers.", 3275 ugeth_err("%s: Can not fill Rx bds with buffers.",
3301 __func__); 3276 __func__);
3302 ucc_geth_memclean(ugeth);
3303 return ret_val; 3277 return ret_val;
3304 } 3278 }
3305 } 3279 }
@@ -3311,7 +3285,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3311 ugeth_err 3285 ugeth_err
3312 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", 3286 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
3313 __func__); 3287 __func__);
3314 ucc_geth_memclean(ugeth);
3315 return -ENOMEM; 3288 return -ENOMEM;
3316 } 3289 }
3317 p_init_enet_pram = 3290 p_init_enet_pram =
@@ -3761,7 +3734,6 @@ static int ucc_geth_open(struct net_device *dev)
3761 if (err) { 3734 if (err) {
3762 if (netif_msg_ifup(ugeth)) 3735 if (netif_msg_ifup(ugeth))
3763 ugeth_err("%s: Cannot enable net device, aborting.", dev->name); 3736 ugeth_err("%s: Cannot enable net device, aborting.", dev->name);
3764 ucc_geth_stop(ugeth);
3765 goto out_err; 3737 goto out_err;
3766 } 3738 }
3767 3739
@@ -3771,7 +3743,6 @@ static int ucc_geth_open(struct net_device *dev)
3771 if (netif_msg_ifup(ugeth)) 3743 if (netif_msg_ifup(ugeth))
3772 ugeth_err("%s: Cannot get IRQ for net device, aborting.", 3744 ugeth_err("%s: Cannot get IRQ for net device, aborting.",
3773 dev->name); 3745 dev->name);
3774 ucc_geth_stop(ugeth);
3775 goto out_err; 3746 goto out_err;
3776 } 3747 }
3777 3748
@@ -3781,7 +3752,7 @@ static int ucc_geth_open(struct net_device *dev)
3781 3752
3782out_err: 3753out_err:
3783 napi_disable(&ugeth->napi); 3754 napi_disable(&ugeth->napi);
3784 3755 ucc_geth_stop(ugeth);
3785 return err; 3756 return err;
3786} 3757}
3787 3758