OSDN Git Service

mwifiex: do not wait on semaphore during card removal
authorXinming Hu <huxm@marvell.com>
Mon, 11 Apr 2016 14:52:40 +0000 (07:52 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 14 Apr 2016 13:01:46 +0000 (16:01 +0300)
Host hang is observed if card is removed before firmware download
gets completed. In this case, firmware will be failed to download and
adapter structure gets freed.

In other thread, mwifiex_remove_card() waits on semaphore until the
firmware download fails. This wait is not necessary and may result in
invalid adapter access.

This patch uses down_trylock to return immediately so that hang issue
won't occur.

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

index 04b975c..b459c70 100644 (file)
@@ -1434,7 +1434,7 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
        struct mwifiex_private *priv = NULL;
        int i;
 
-       if (down_interruptible(sem))
+       if (down_trylock(sem))
                goto exit_sem_err;
 
        if (!adapter)