diff mbox

[2/8] mwifiex: report error to PCIe for suspend failure

Message ID 1475066908-11771-2-git-send-email-akarwar@marvell.com (mailing list archive)
State Accepted
Commit 5190f2e405919cd30ba2f12c58129fb2d71cd6b6
Delegated to: Kalle Valo
Headers show

Commit Message

Amitkumar Karwar Sept. 28, 2016, 12:48 p.m. UTC
When host_sleep_config command fails, we should return an error to
PCIe, instead of continuing (and possibly panicking, when we try to keep
processing a timed-out ioctl after we return "successfully" from
suspend).

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Brian Norris Oct. 4, 2016, 10:24 p.m. UTC | #1
On Wed, Sep 28, 2016 at 06:18:22PM +0530, Amitkumar Karwar wrote:
> When host_sleep_config command fails, we should return an error to
> PCIe, instead of continuing (and possibly panicking, when we try to keep
> processing a timed-out ioctl after we return "successfully" from
> suspend).
> 
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>

In case it helps to note this: this is what's already done in sdio.c,
and adding this patch prevented some crashes on my system with pcie.c.

Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>

You might want to fixup usb.c to do the same.

> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index 2833d47..063c707 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -101,7 +101,6 @@ static int mwifiex_pcie_suspend(struct device *dev)
>  {
>  	struct mwifiex_adapter *adapter;
>  	struct pcie_service_card *card;
> -	int hs_actived;
>  	struct pci_dev *pdev = to_pci_dev(dev);
>  
>  	if (pdev) {
> @@ -117,7 +116,14 @@ static int mwifiex_pcie_suspend(struct device *dev)
>  
>  	adapter = card->adapter;
>  
> -	hs_actived = mwifiex_enable_hs(adapter);
> +	/* Enable the Host Sleep */
> +	if (!mwifiex_enable_hs(adapter)) {
> +		mwifiex_dbg(adapter, ERROR,
> +			    "cmd: failed to suspend\n");
> +		adapter->hs_enabling = false;
> +		return -EFAULT;
> +	}
> +
>  	flush_workqueue(adapter->workqueue);
>  
>  	/* Indicate device suspended */
diff mbox

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 2833d47..063c707 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -101,7 +101,6 @@  static int mwifiex_pcie_suspend(struct device *dev)
 {
 	struct mwifiex_adapter *adapter;
 	struct pcie_service_card *card;
-	int hs_actived;
 	struct pci_dev *pdev = to_pci_dev(dev);
 
 	if (pdev) {
@@ -117,7 +116,14 @@  static int mwifiex_pcie_suspend(struct device *dev)
 
 	adapter = card->adapter;
 
-	hs_actived = mwifiex_enable_hs(adapter);
+	/* Enable the Host Sleep */
+	if (!mwifiex_enable_hs(adapter)) {
+		mwifiex_dbg(adapter, ERROR,
+			    "cmd: failed to suspend\n");
+		adapter->hs_enabling = false;
+		return -EFAULT;
+	}
+
 	flush_workqueue(adapter->workqueue);
 
 	/* Indicate device suspended */