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 80df2ab..2aa80af 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))