Commit 4daf5f19 authored by Xiaomeng Tong's avatar Xiaomeng Tong Committed by Jakub Kicinski

qed: remove an unneed NULL check on list iterator

The define for_each_pci_dev(d) is:
 while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)

Thus, the list iterator 'd' is always non-NULL so it doesn't need to
be checked. So just remove the unnecessary NULL check. Also remove the
unnecessary initializer because the list iterator is always initialized.
Signed-off-by: default avatarXiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220406015921.29267-1-xiam0nd.tong@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6a62924c
...@@ -161,11 +161,11 @@ EXPORT_SYMBOL(qed_vlan_get_ndev); ...@@ -161,11 +161,11 @@ EXPORT_SYMBOL(qed_vlan_get_ndev);
struct pci_dev *qed_validate_ndev(struct net_device *ndev) struct pci_dev *qed_validate_ndev(struct net_device *ndev)
{ {
struct pci_dev *pdev = NULL;
struct net_device *upper; struct net_device *upper;
struct pci_dev *pdev;
for_each_pci_dev(pdev) { for_each_pci_dev(pdev) {
if (pdev && pdev->driver && if (pdev->driver &&
!strcmp(pdev->driver->name, "qede")) { !strcmp(pdev->driver->name, "qede")) {
upper = pci_get_drvdata(pdev); upper = pci_get_drvdata(pdev);
if (upper->ifindex == ndev->ifindex) if (upper->ifindex == ndev->ifindex)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment