Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ca046d5 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller
Browse files

igb: do not check for vf_data if we didn't enable vfs



The driver is currently dumping a message in the log about failing to
allocate vf data when max_vfs is equal to 0.  This change makes it so the
error message is only displayed if we set max_vfs to a non zero value.

Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d165771
Loading
Loading
Loading
Loading
+22 −15
Original line number Original line Diff line number Diff line
@@ -1261,21 +1261,27 @@ static int __devinit igb_probe(struct pci_dev *pdev,
		int i;
		int i;
		unsigned char mac_addr[ETH_ALEN];
		unsigned char mac_addr[ETH_ALEN];


		if (num_vfs)
		if (num_vfs) {
			adapter->vf_data = kcalloc(num_vfs,
			adapter->vf_data = kcalloc(num_vfs,
						sizeof(struct vf_data_storage),
						sizeof(struct vf_data_storage),
						GFP_KERNEL);
						GFP_KERNEL);
			if (!adapter->vf_data) {
			if (!adapter->vf_data) {
			dev_err(&pdev->dev, "Could not allocate VF private "
				dev_err(&pdev->dev,
				"data - IOV enable failed\n");
				        "Could not allocate VF private data - "
					"IOV enable failed\n");
			} else {
			} else {
				err = pci_enable_sriov(pdev, num_vfs);
				err = pci_enable_sriov(pdev, num_vfs);
				if (!err) {
				if (!err) {
					adapter->vfs_allocated_count = num_vfs;
					adapter->vfs_allocated_count = num_vfs;
				dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs);
					dev_info(&pdev->dev,
				for (i = 0; i < adapter->vfs_allocated_count; i++) {
					         "%d vfs allocated\n",
					         num_vfs);
					for (i = 0;
					     i < adapter->vfs_allocated_count;
					     i++) {
						random_ether_addr(mac_addr);
						random_ether_addr(mac_addr);
					igb_set_vf_mac(adapter, i, mac_addr);
						igb_set_vf_mac(adapter, i,
						               mac_addr);
					}
					}
				} else {
				} else {
					kfree(adapter->vf_data);
					kfree(adapter->vf_data);
@@ -1283,6 +1289,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
				}
				}
			}
			}
		}
		}
	}


#endif
#endif
	/* setup the private structure */
	/* setup the private structure */