mlx4_core: Do not map BF area if capability is 0
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Sun, 19 Feb 2012 21:38:52 +0000 (21:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Feb 2012 00:26:34 +0000 (19:26 -0500)
BF can be disabled in some cases, the capability field, bf_reg_size is set
to zero in this case. Don't map the BF area in this case, it would cause
failures.  In addition, leaving the BF area unmapped
also alerts the ETH driver to not use BF.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c

index 678558b502fc31e506633e0713805f58c8676108..9c5fbad513f8f23f88ef6d6634fdac1645081dff 100644 (file)
@@ -986,6 +986,9 @@ static int map_bf_area(struct mlx4_dev *dev)
        resource_size_t bf_len;
        int err = 0;
 
+       if (!dev->caps.bf_reg_size)
+               return -ENXIO;
+
        bf_start = pci_resource_start(dev->pdev, 2) +
                        (dev->caps.num_uars << PAGE_SHIFT);
        bf_len = pci_resource_len(dev->pdev, 2) -