Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[cascardo/linux.git] / drivers / net / ethernet / mellanox / mlx4 / main.c
index a6ee22b..8bb05b4 100644 (file)
@@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev,
        for (port = 0; port <  dev->caps.num_ports; port++) {
                /* Change the port type only if the new type is different
                 * from the current, and not set to Auto */
-               if (port_types[port] != dev->caps.port_type[port + 1]) {
+               if (port_types[port] != dev->caps.port_type[port + 1])
                        change = 1;
-                       dev->caps.port_type[port + 1] = port_types[port];
-               }
        }
        if (change) {
                mlx4_unregister_device(dev);
                for (port = 1; port <= dev->caps.num_ports; port++) {
                        mlx4_CLOSE_PORT(dev, port);
+                       dev->caps.port_type[port] = port_types[port - 1];
                        err = mlx4_SET_PORT(dev, port);
                        if (err) {
                                mlx4_err(dev, "Failed to set port %d, "
@@ -1079,6 +1078,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) -
@@ -1655,13 +1657,11 @@ static int mlx4_init_steering(struct mlx4_dev *dev)
        if (!priv->steer)
                return -ENOMEM;
 
-       for (i = 0; i < num_entries; i++) {
+       for (i = 0; i < num_entries; i++)
                for (j = 0; j < MLX4_NUM_STEERS; j++) {
                        INIT_LIST_HEAD(&priv->steer[i].promisc_qps[j]);
                        INIT_LIST_HEAD(&priv->steer[i].steer_entries[j]);
                }
-               INIT_LIST_HEAD(&priv->steer[i].high_prios);
-       }
        return 0;
 }
 
@@ -1937,7 +1937,7 @@ slave_start:
                goto err_master_mfunc;
 
        priv->msix_ctl.pool_bm = 0;
-       spin_lock_init(&priv->msix_ctl.pool_lock);
+       mutex_init(&priv->msix_ctl.pool_lock);
 
        mlx4_enable_msi_x(dev);
        if ((mlx4_is_mfunc(dev)) &&