]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mlx4_core: Perform correct resource cleanup if mlx4_QUERY_ADAPTER() fails
authorDotan Barak <dotanb@dev.mellanox.co.il>
Sun, 21 Oct 2012 14:59:23 +0000 (14:59 +0000)
committerRoland Dreier <roland@purestorage.com>
Tue, 23 Oct 2012 16:03:37 +0000 (09:03 -0700)
Fixed the resource cleanup to act correctly and prevent a kernel oops when
mlx4_QUERY_ADAPTER() fails.

Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/net/ethernet/mellanox/mlx4/main.c

index 80df2ab0177c398122725a85c82133788b711198..2aa80afd98d20038b2a174ac38a52a5eb003eaba 100644 (file)
@@ -1405,7 +1405,10 @@ unmap_bf:
        unmap_bf_area(dev);
 
 err_close:
-       mlx4_close_hca(dev);
+       if (mlx4_is_slave(dev))
+               mlx4_slave_exit(dev);
+       else
+               mlx4_CLOSE_HCA(dev, 0);
 
 err_free_icm:
        if (!mlx4_is_slave(dev))