Commit 5397db90 authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman

staging: silicom: remove redundant pci_get_drvdata() call

The pci_get_drvdata() and checking NULL for dev are
called twice in while loop in is_bypass_dev().
Signed-off-by: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f4285d1
...@@ -149,38 +149,33 @@ static int is_bypass_dev(int if_index) ...@@ -149,38 +149,33 @@ static int is_bypass_dev(int if_index)
while ((pdev = pci_get_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) { while ((pdev = pci_get_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) {
dev = pci_get_drvdata(pdev); dev = pci_get_drvdata(pdev);
if (dev != NULL) { if ((dev != NULL) && (dev->ifindex == if_index)) {
dev = pci_get_drvdata(pdev); if ((pdev->vendor == SILICOM_VID) &&
if ((dev != NULL) && (dev->ifindex == if_index)) { (pdev->device >= SILICOM_BP_PID_MIN) &&
if ((pdev->vendor == SILICOM_VID) && (pdev->device <= SILICOM_BP_PID_MAX)) {
(pdev->device >= SILICOM_BP_PID_MIN) && goto send_cmd;
(pdev->device <= SILICOM_BP_PID_MAX)) { }
goto send_cmd;
}
#if defined(BP_VENDOR_SUPPORT) && defined(ETHTOOL_GDRVINFO) #if defined(BP_VENDOR_SUPPORT) && defined(ETHTOOL_GDRVINFO)
else { else {
struct ethtool_drvinfo info; struct ethtool_drvinfo info;
const struct ethtool_ops *ops = const struct ethtool_ops *ops =
dev->ethtool_ops; dev->ethtool_ops;
int k = 0; int k = 0;
if (ops->get_drvinfo) { if (ops->get_drvinfo) {
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.cmd = ETHTOOL_GDRVINFO; info.cmd = ETHTOOL_GDRVINFO;
ops->get_drvinfo(dev, &info); ops->get_drvinfo(dev, &info);
for (; bp_desc_array[k]; k++) for (; bp_desc_array[k]; k++)
if (! if (!(strcmp(bp_desc_array[k],
(strcmp info.driver)))
(bp_desc_array[k], goto send_cmd;
info.driver)))
goto send_cmd;
}
} }
#endif
return -1;
} }
#endif
return -1;
} }
} }
send_cmd: send_cmd:
......
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