From: Amitkumar Karwar <akarwar@marvell.com>
To: <linux-wireless@vger.kernel.org>
Cc: Cathy Luo <cluo@marvell.com>,
Nishant Sarmukadam <nishants@marvell.com>, <rajatja@google.com>,
<briannorris@google.com>, <dmitry.torokhov@gmail.com>,
Brian Norris <briannorris@chromium.org>,
Amitkumar Karwar <akarwar@marvell.com>
Subject: [PATCH v4 10/11] mwifiex: stop checking for NULL drvata/intfdata
Date: Fri, 18 Nov 2016 19:30:33 +0530 [thread overview]
Message-ID: <1479477634-27841-10-git-send-email-akarwar@marvell.com> (raw)
In-Reply-To: <1479477634-27841-1-git-send-email-akarwar@marvell.com>
From: Brian Norris <briannorris@chromium.org>
These are never NULL, so stop making people think they might be.
I don't change this for SDIO because SDIO has a racy card-reset handler
that reallocates this struct. I'd rather not touch that mess right now.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
v4: Same as v1, v2, v3
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 14 +++++---------
drivers/net/wireless/marvell/mwifiex/usb.c | 15 +++------------
2 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index f6d28d9..98299a1 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -118,10 +118,6 @@ static int mwifiex_pcie_suspend(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev);
card = pci_get_drvdata(pdev);
- if (!card) {
- dev_err(dev, "card structure is not valid\n");
- return 0;
- }
/* Might still be loading firmware */
wait_for_completion(&card->fw_done);
@@ -166,8 +162,9 @@ static int mwifiex_pcie_resume(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev);
card = pci_get_drvdata(pdev);
- if (!card || !card->adapter) {
- dev_err(dev, "Card or adapter structure is not valid\n");
+
+ if (!card->adapter) {
+ dev_err(dev, "adapter structure is not valid\n");
return 0;
}
@@ -249,8 +246,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
struct mwifiex_private *priv;
card = pci_get_drvdata(pdev);
- if (!card)
- return;
wait_for_completion(&card->fw_done);
@@ -2243,7 +2238,8 @@ static irqreturn_t mwifiex_pcie_interrupt(int irq, void *context)
}
card = pci_get_drvdata(pdev);
- if (!card || !card->adapter) {
+
+ if (!card->adapter) {
pr_err("info: %s: card=%p adapter=%p\n", __func__, card,
card ? card->adapter : NULL);
goto exit;
diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
index 55e3a01..c3f696a 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -503,11 +503,6 @@ static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message)
struct usb_tx_data_port *port;
int i, j;
- if (!card) {
- dev_err(&intf->dev, "%s: card is NULL\n", __func__);
- return 0;
- }
-
/* Might still be loading firmware */
wait_for_completion(&card->fw_done);
@@ -574,8 +569,9 @@ static int mwifiex_usb_resume(struct usb_interface *intf)
struct mwifiex_adapter *adapter;
int i;
- if (!card || !card->adapter) {
- pr_err("%s: card or card->adapter is NULL\n", __func__);
+ if (!card->adapter) {
+ dev_err(&intf->dev, "%s: card->adapter is NULL\n",
+ __func__);
return 0;
}
adapter = card->adapter;
@@ -617,11 +613,6 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf)
struct usb_card_rec *card = usb_get_intfdata(intf);
struct mwifiex_adapter *adapter;
- if (!card) {
- dev_err(&intf->dev, "%s: card is NULL\n", __func__);
- return;
- }
-
wait_for_completion(&card->fw_done);
adapter = card->adapter;
--
1.9.1
next prev parent reply other threads:[~2016-11-18 14:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 14:00 [PATCH v4 01/11] mwifiex: check tx_hw_pending before downloading sleep confirm Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 02/11] mwifiex: complete blocked power save handshake in main process Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 03/11] mwifiex: resolve races between async FW init (failure) and device removal Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 04/11] mwifiex: remove redundant pdev check in suspend/resume handlers Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 05/11] mwifiex: don't pretend to resume while remove()'ing Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 06/11] mwifiex: resolve suspend() race with async FW init failure Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 07/11] mwifiex: reset card->adapter during device unregister Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 08/11] mwifiex: usb: handle HS failures Amitkumar Karwar
2016-11-18 14:00 ` [PATCH v4 09/11] mwifiex: sdio: don't check for NULL sdio_func Amitkumar Karwar
2016-11-18 14:00 ` Amitkumar Karwar [this message]
2016-11-18 14:00 ` [PATCH v4 11/11] mwifiex: pcie: stop checking for NULL adapter->card Amitkumar Karwar
2016-11-19 7:19 ` [v4, 01/11] mwifiex: check tx_hw_pending before downloading sleep confirm Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479477634-27841-10-git-send-email-akarwar@marvell.com \
--to=akarwar@marvell.com \
--cc=briannorris@chromium.org \
--cc=briannorris@google.com \
--cc=cluo@marvell.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nishants@marvell.com \
--cc=rajatja@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).