summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaeseok Youn <daeseok.youn@gmail.com>2014-04-23 17:18:42 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-25 15:34:16 -0700
commit5397db900a3e67a86b21860289e80b5a8d8de4cf (patch)
treea074904fd1ccd772feb793faaf03a6e31f150e69
parent2f4285d17d3a5ae42e2811005dbcd4818d5d6ebe (diff)
downloadlinux-stable-5397db900a3e67a86b21860289e80b5a8d8de4cf.tar.gz
linux-stable-5397db900a3e67a86b21860289e80b5a8d8de4cf.tar.bz2
linux-stable-5397db900a3e67a86b21860289e80b5a8d8de4cf.zip
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: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/silicom/bypasslib/bypass.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/drivers/staging/silicom/bypasslib/bypass.c b/drivers/staging/silicom/bypasslib/bypass.c
index 09e00dac04f3..a58251f5a8f8 100644
--- a/drivers/staging/silicom/bypasslib/bypass.c
+++ b/drivers/staging/silicom/bypasslib/bypass.c
@@ -149,38 +149,33 @@ static int is_bypass_dev(int if_index)
while ((pdev = pci_get_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) {
dev = pci_get_drvdata(pdev);
- if (dev != NULL) {
- dev = pci_get_drvdata(pdev);
- if ((dev != NULL) && (dev->ifindex == if_index)) {
- if ((pdev->vendor == SILICOM_VID) &&
- (pdev->device >= SILICOM_BP_PID_MIN) &&
- (pdev->device <= SILICOM_BP_PID_MAX)) {
- goto send_cmd;
- }
+ if ((dev != NULL) && (dev->ifindex == if_index)) {
+ if ((pdev->vendor == SILICOM_VID) &&
+ (pdev->device >= SILICOM_BP_PID_MIN) &&
+ (pdev->device <= SILICOM_BP_PID_MAX)) {
+ goto send_cmd;
+ }
#if defined(BP_VENDOR_SUPPORT) && defined(ETHTOOL_GDRVINFO)
- else {
- struct ethtool_drvinfo info;
- const struct ethtool_ops *ops =
- dev->ethtool_ops;
- int k = 0;
-
- if (ops->get_drvinfo) {
- memset(&info, 0, sizeof(info));
- info.cmd = ETHTOOL_GDRVINFO;
- ops->get_drvinfo(dev, &info);
- for (; bp_desc_array[k]; k++)
- if (!
- (strcmp
- (bp_desc_array[k],
- info.driver)))
- goto send_cmd;
-
- }
+ else {
+ struct ethtool_drvinfo info;
+ const struct ethtool_ops *ops =
+ dev->ethtool_ops;
+ int k = 0;
+
+ if (ops->get_drvinfo) {
+ memset(&info, 0, sizeof(info));
+ info.cmd = ETHTOOL_GDRVINFO;
+ ops->get_drvinfo(dev, &info);
+ for (; bp_desc_array[k]; k++)
+ if (!(strcmp(bp_desc_array[k],
+ info.driver)))
+ goto send_cmd;
}
-#endif
- return -1;
+
}
+#endif
+ return -1;
}
}
send_cmd: