@@ -2487,14 +2487,6 @@ static int ib_mad_port_open(struct ib_device *device,
24872487 unsigned long flags ;
24882488 char name [sizeof "ib_mad123" ];
24892489
2490- /* First, check if port already open at MAD layer */
2491- port_priv = ib_get_mad_port (device , port_num );
2492- if (port_priv ) {
2493- printk (KERN_DEBUG PFX "%s port %d already open\n" ,
2494- device -> name , port_num );
2495- return 0 ;
2496- }
2497-
24982490 /* Create new device info */
24992491 port_priv = kmalloc (sizeof * port_priv , GFP_KERNEL );
25002492 if (!port_priv ) {
@@ -2619,7 +2611,7 @@ static int ib_mad_port_close(struct ib_device *device, int port_num)
26192611
26202612static void ib_mad_init_device (struct ib_device * device )
26212613{
2622- int ret , num_ports , cur_port , i , ret2 ;
2614+ int num_ports , cur_port , i ;
26232615
26242616 if (device -> node_type == IB_NODE_SWITCH ) {
26252617 num_ports = 1 ;
@@ -2629,47 +2621,37 @@ static void ib_mad_init_device(struct ib_device *device)
26292621 cur_port = 1 ;
26302622 }
26312623 for (i = 0 ; i < num_ports ; i ++ , cur_port ++ ) {
2632- ret = ib_mad_port_open (device , cur_port );
2633- if (ret ) {
2624+ if (ib_mad_port_open (device , cur_port )) {
26342625 printk (KERN_ERR PFX "Couldn't open %s port %d\n" ,
26352626 device -> name , cur_port );
26362627 goto error_device_open ;
26372628 }
2638- ret = ib_agent_port_open (device , cur_port );
2639- if (ret ) {
2629+ if (ib_agent_port_open (device , cur_port )) {
26402630 printk (KERN_ERR PFX "Couldn't open %s port %d "
26412631 "for agents\n" ,
26422632 device -> name , cur_port );
26432633 goto error_device_open ;
26442634 }
26452635 }
2646-
2647- goto error_device_query ;
2636+ return ;
26482637
26492638error_device_open :
26502639 while (i > 0 ) {
26512640 cur_port -- ;
2652- ret2 = ib_agent_port_close (device , cur_port );
2653- if (ret2 ) {
2641+ if (ib_agent_port_close (device , cur_port ))
26542642 printk (KERN_ERR PFX "Couldn't close %s port %d "
26552643 "for agents\n" ,
26562644 device -> name , cur_port );
2657- }
2658- ret2 = ib_mad_port_close (device , cur_port );
2659- if (ret2 ) {
2645+ if (ib_mad_port_close (device , cur_port ))
26602646 printk (KERN_ERR PFX "Couldn't close %s port %d\n" ,
26612647 device -> name , cur_port );
2662- }
26632648 i -- ;
26642649 }
2665-
2666- error_device_query :
2667- return ;
26682650}
26692651
26702652static void ib_mad_remove_device (struct ib_device * device )
26712653{
2672- int ret = 0 , i , num_ports , cur_port , ret2 ;
2654+ int i , num_ports , cur_port ;
26732655
26742656 if (device -> node_type == IB_NODE_SWITCH ) {
26752657 num_ports = 1 ;
@@ -2679,21 +2661,13 @@ static void ib_mad_remove_device(struct ib_device *device)
26792661 cur_port = 1 ;
26802662 }
26812663 for (i = 0 ; i < num_ports ; i ++ , cur_port ++ ) {
2682- ret2 = ib_agent_port_close (device , cur_port );
2683- if (ret2 ) {
2664+ if (ib_agent_port_close (device , cur_port ))
26842665 printk (KERN_ERR PFX "Couldn't close %s port %d "
26852666 "for agents\n" ,
26862667 device -> name , cur_port );
2687- if (!ret )
2688- ret = ret2 ;
2689- }
2690- ret2 = ib_mad_port_close (device , cur_port );
2691- if (ret2 ) {
2668+ if (ib_mad_port_close (device , cur_port ))
26922669 printk (KERN_ERR PFX "Couldn't close %s port %d\n" ,
26932670 device -> name , cur_port );
2694- if (!ret )
2695- ret = ret2 ;
2696- }
26972671 }
26982672}
26992673
0 commit comments