]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: remove redundant pdev check in suspend/resume handlers
authorAmitkumar Karwar <akarwar@marvell.com>
Fri, 18 Nov 2016 14:00:27 +0000 (19:30 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 19 Nov 2016 07:18:48 +0000 (09:18 +0200)
to_pci_dev() would just do struct offset arithmetic on struct
device to get 'pdev' pointer. We never get NULL pdev pointer.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/pcie.c

index 547806f8f9233bec39c29baac5b48989dc1571bd..86ae0841aa70752ad8b61355a63b2742b2550a50 100644 (file)
@@ -117,14 +117,9 @@ static int mwifiex_pcie_suspend(struct device *dev)
        struct pcie_service_card *card;
        struct pci_dev *pdev = to_pci_dev(dev);
 
-       if (pdev) {
-               card = pci_get_drvdata(pdev);
-               if (!card || !card->adapter) {
-                       pr_err("Card or adapter structure is not valid\n");
-                       return 0;
-               }
-       } else {
-               pr_err("PCIE device is not specified\n");
+       card = pci_get_drvdata(pdev);
+       if (!card || !card->adapter) {
+               pr_err("Card or adapter structure is not valid\n");
                return 0;
        }
 
@@ -162,14 +157,9 @@ static int mwifiex_pcie_resume(struct device *dev)
        struct pcie_service_card *card;
        struct pci_dev *pdev = to_pci_dev(dev);
 
-       if (pdev) {
-               card = pci_get_drvdata(pdev);
-               if (!card || !card->adapter) {
-                       pr_err("Card or adapter structure is not valid\n");
-                       return 0;
-               }
-       } else {
-               pr_err("PCIE device is not specified\n");
+       card = pci_get_drvdata(pdev);
+       if (!card || !card->adapter) {
+               dev_err(dev, "Card or adapter structure is not valid\n");
                return 0;
        }