@@ -122,7 +122,7 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
122
122
{
123
123
struct ixgbe_mac_info * mac = & hw -> mac ;
124
124
struct ixgbe_phy_info * phy = & hw -> phy ;
125
- s32 ret_val = 0 ;
125
+ s32 ret_val ;
126
126
u16 list_offset , data_offset ;
127
127
128
128
/* Identify the PHY */
@@ -147,28 +147,23 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
147
147
148
148
/* Call SFP+ identify routine to get the SFP+ module type */
149
149
ret_val = phy -> ops .identify_sfp (hw );
150
- if (ret_val != 0 )
151
- goto out ;
152
- else if (hw -> phy .sfp_type == ixgbe_sfp_type_unknown ) {
153
- ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED ;
154
- goto out ;
155
- }
150
+ if (ret_val )
151
+ return ret_val ;
152
+ if (hw -> phy .sfp_type == ixgbe_sfp_type_unknown )
153
+ return IXGBE_ERR_SFP_NOT_SUPPORTED ;
156
154
157
155
/* Check to see if SFP+ module is supported */
158
156
ret_val = ixgbe_get_sfp_init_sequence_offsets (hw ,
159
157
& list_offset ,
160
158
& data_offset );
161
- if (ret_val != 0 ) {
162
- ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED ;
163
- goto out ;
164
- }
159
+ if (ret_val )
160
+ return IXGBE_ERR_SFP_NOT_SUPPORTED ;
165
161
break ;
166
162
default :
167
163
break ;
168
164
}
169
165
170
- out :
171
- return ret_val ;
166
+ return 0 ;
172
167
}
173
168
174
169
/**
@@ -183,7 +178,7 @@ static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
183
178
{
184
179
u32 regval ;
185
180
u32 i ;
186
- s32 ret_val = 0 ;
181
+ s32 ret_val ;
187
182
188
183
ret_val = ixgbe_start_hw_generic (hw );
189
184
@@ -203,11 +198,13 @@ static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
203
198
IXGBE_WRITE_REG (hw , IXGBE_DCA_RXCTRL (i ), regval );
204
199
}
205
200
201
+ if (ret_val )
202
+ return ret_val ;
203
+
206
204
/* set the completion timeout for interface */
207
- if (ret_val == 0 )
208
- ixgbe_set_pcie_completion_timeout (hw );
205
+ ixgbe_set_pcie_completion_timeout (hw );
209
206
210
- return ret_val ;
207
+ return 0 ;
211
208
}
212
209
213
210
/**
@@ -222,7 +219,6 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
222
219
ixgbe_link_speed * speed ,
223
220
bool * autoneg )
224
221
{
225
- s32 status = 0 ;
226
222
u32 autoc = 0 ;
227
223
228
224
/*
@@ -262,11 +258,10 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
262
258
break ;
263
259
264
260
default :
265
- status = IXGBE_ERR_LINK_SETUP ;
266
- break ;
261
+ return IXGBE_ERR_LINK_SETUP ;
267
262
}
268
263
269
- return status ;
264
+ return 0 ;
270
265
}
271
266
272
267
/**
@@ -277,14 +272,12 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
277
272
**/
278
273
static enum ixgbe_media_type ixgbe_get_media_type_82598 (struct ixgbe_hw * hw )
279
274
{
280
- enum ixgbe_media_type media_type ;
281
-
282
275
/* Detect if there is a copper PHY attached. */
283
276
switch (hw -> phy .type ) {
284
277
case ixgbe_phy_cu_unknown :
285
278
case ixgbe_phy_tn :
286
- media_type = ixgbe_media_type_copper ;
287
- goto out ;
279
+ return ixgbe_media_type_copper ;
280
+
288
281
default :
289
282
break ;
290
283
}
@@ -294,30 +287,27 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
294
287
case IXGBE_DEV_ID_82598 :
295
288
case IXGBE_DEV_ID_82598_BX :
296
289
/* Default device ID is mezzanine card KX/KX4 */
297
- media_type = ixgbe_media_type_backplane ;
298
- break ;
290
+ return ixgbe_media_type_backplane ;
291
+
299
292
case IXGBE_DEV_ID_82598AF_DUAL_PORT :
300
293
case IXGBE_DEV_ID_82598AF_SINGLE_PORT :
301
294
case IXGBE_DEV_ID_82598_DA_DUAL_PORT :
302
295
case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM :
303
296
case IXGBE_DEV_ID_82598EB_XF_LR :
304
297
case IXGBE_DEV_ID_82598EB_SFP_LOM :
305
- media_type = ixgbe_media_type_fiber ;
306
- break ;
298
+ return ixgbe_media_type_fiber ;
299
+
307
300
case IXGBE_DEV_ID_82598EB_CX4 :
308
301
case IXGBE_DEV_ID_82598_CX4_DUAL_PORT :
309
- media_type = ixgbe_media_type_cx4 ;
310
- break ;
302
+ return ixgbe_media_type_cx4 ;
303
+
311
304
case IXGBE_DEV_ID_82598AT :
312
305
case IXGBE_DEV_ID_82598AT2 :
313
- media_type = ixgbe_media_type_copper ;
314
- break ;
306
+ return ixgbe_media_type_copper ;
307
+
315
308
default :
316
- media_type = ixgbe_media_type_unknown ;
317
- break ;
309
+ return ixgbe_media_type_unknown ;
318
310
}
319
- out :
320
- return media_type ;
321
311
}
322
312
323
313
/**
@@ -328,7 +318,6 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
328
318
**/
329
319
static s32 ixgbe_fc_enable_82598 (struct ixgbe_hw * hw )
330
320
{
331
- s32 ret_val = 0 ;
332
321
u32 fctrl_reg ;
333
322
u32 rmcs_reg ;
334
323
u32 reg ;
@@ -338,10 +327,8 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
338
327
bool link_up ;
339
328
340
329
/* Validate the water mark configuration */
341
- if (!hw -> fc .pause_time ) {
342
- ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS ;
343
- goto out ;
344
- }
330
+ if (!hw -> fc .pause_time )
331
+ return IXGBE_ERR_INVALID_LINK_SETTINGS ;
345
332
346
333
/* Low water mark of zero causes XOFF floods */
347
334
for (i = 0 ; i < MAX_TRAFFIC_CLASS ; i ++ ) {
@@ -350,8 +337,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
350
337
if (!hw -> fc .low_water [i ] ||
351
338
hw -> fc .low_water [i ] >= hw -> fc .high_water [i ]) {
352
339
hw_dbg (hw , "Invalid water mark configuration\n" );
353
- ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS ;
354
- goto out ;
340
+ return IXGBE_ERR_INVALID_LINK_SETTINGS ;
355
341
}
356
342
}
357
343
}
@@ -428,8 +414,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
428
414
break ;
429
415
default :
430
416
hw_dbg (hw , "Flow control param set incorrectly\n" );
431
- ret_val = IXGBE_ERR_CONFIG ;
432
- goto out ;
417
+ return IXGBE_ERR_CONFIG ;
433
418
}
434
419
435
420
/* Set 802.3x based flow control settings. */
@@ -460,8 +445,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
460
445
/* Configure flow control refresh threshold value */
461
446
IXGBE_WRITE_REG (hw , IXGBE_FCRTV , hw -> fc .pause_time / 2 );
462
447
463
- out :
464
- return ret_val ;
448
+ return 0 ;
465
449
}
466
450
467
451
/**
@@ -597,7 +581,7 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
597
581
}
598
582
599
583
if (!* link_up )
600
- goto out ;
584
+ return 0 ;
601
585
}
602
586
603
587
links_reg = IXGBE_READ_REG (hw , IXGBE_LINKS );
@@ -628,7 +612,6 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
628
612
(ixgbe_validate_link_ready (hw ) != 0 ))
629
613
* link_up = false;
630
614
631
- out :
632
615
return 0 ;
633
616
}
634
617
@@ -645,7 +628,6 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
645
628
bool autoneg_wait_to_complete )
646
629
{
647
630
bool autoneg = false;
648
- s32 status = 0 ;
649
631
ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN ;
650
632
u32 curr_autoc = IXGBE_READ_REG (hw , IXGBE_AUTOC );
651
633
u32 autoc = curr_autoc ;
@@ -656,7 +638,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
656
638
speed &= link_capabilities ;
657
639
658
640
if (speed == IXGBE_LINK_SPEED_UNKNOWN )
659
- status = IXGBE_ERR_LINK_SETUP ;
641
+ return IXGBE_ERR_LINK_SETUP ;
660
642
661
643
/* Set KX4/KX support according to speed requested */
662
644
else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
@@ -670,17 +652,11 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
670
652
IXGBE_WRITE_REG (hw , IXGBE_AUTOC , autoc );
671
653
}
672
654
673
- if (status == 0 ) {
674
- /*
675
- * Setup and restart the link based on the new values in
676
- * ixgbe_hw This will write the AUTOC register based on the new
677
- * stored values
678
- */
679
- status = ixgbe_start_mac_link_82598 (hw ,
680
- autoneg_wait_to_complete );
681
- }
682
-
683
- return status ;
655
+ /* Setup and restart the link based on the new values in
656
+ * ixgbe_hw This will write the AUTOC register based on the new
657
+ * stored values
658
+ */
659
+ return ixgbe_start_mac_link_82598 (hw , autoneg_wait_to_complete );
684
660
}
685
661
686
662
@@ -717,7 +693,7 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
717
693
**/
718
694
static s32 ixgbe_reset_hw_82598 (struct ixgbe_hw * hw )
719
695
{
720
- s32 status = 0 ;
696
+ s32 status ;
721
697
s32 phy_status = 0 ;
722
698
u32 ctrl ;
723
699
u32 gheccr ;
@@ -727,8 +703,8 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
727
703
728
704
/* Call adapter stop to disable tx/rx and clear interrupts */
729
705
status = hw -> mac .ops .stop_adapter (hw );
730
- if (status != 0 )
731
- goto reset_hw_out ;
706
+ if (status )
707
+ return status ;
732
708
733
709
/*
734
710
* Power up the Atlas Tx lanes if they are currently powered down.
@@ -770,7 +746,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
770
746
/* Init PHY and function pointers, perform SFP setup */
771
747
phy_status = hw -> phy .ops .init (hw );
772
748
if (phy_status == IXGBE_ERR_SFP_NOT_SUPPORTED )
773
- goto reset_hw_out ;
749
+ return phy_status ;
774
750
if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT )
775
751
goto mac_reset_top ;
776
752
@@ -836,7 +812,6 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
836
812
*/
837
813
hw -> mac .ops .init_rx_addrs (hw );
838
814
839
- reset_hw_out :
840
815
if (phy_status )
841
816
status = phy_status ;
842
817
0 commit comments