Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox...
[linux-2.6-microblaze.git] / drivers / net / ethernet / mellanox / mlx5 / core / dev.c
index f6b1da9..5bb6a26 100644 (file)
@@ -311,13 +311,20 @@ static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
 /* Must be called with intf_mutex held */
 struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
 {
-       u32 pci_id = mlx5_gen_pci_id(dev);
        struct mlx5_core_dev *res = NULL;
        struct mlx5_core_dev *tmp_dev;
        struct mlx5_priv *priv;
+       u32 pci_id;
 
+       if (!mlx5_core_is_pf(dev))
+               return NULL;
+
+       pci_id = mlx5_gen_pci_id(dev);
        list_for_each_entry(priv, &mlx5_dev_list, dev_list) {
                tmp_dev = container_of(priv, struct mlx5_core_dev, priv);
+               if (!mlx5_core_is_pf(tmp_dev))
+                       continue;
+
                if ((dev != tmp_dev) && (mlx5_gen_pci_id(tmp_dev) == pci_id)) {
                        res = tmp_dev;
                        break;