Skip to content

Commit

Permalink
mwifiex: remove redundant pdev check in suspend/resume handlers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amitkumar Karwar authored and Kalle Valo committed Nov 19, 2016
1 parent 4a79aa1 commit a1beec4
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions drivers/net/wireless/marvell/mwifiex/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a1beec4

Please sign in to comment.