Commit 19a177e6 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman

Staging: bcm: Reverse semaphore locking in IOCTL_BCM_BUFFER_DOWNLOAD_STOP.

This patch reorders the semaphore locking.
It makes better sense to first evaluate
fw_download_sema semaphore then
NVMRdmWrmLocl semaphore. The
fw_download_sema is suppose to be
acquired in the START ioctl.  If this is
not true, then it does not make sense
to continue.
Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8fbebb09
...@@ -860,6 +860,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -860,6 +860,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
} }
case IOCTL_BCM_BUFFER_DOWNLOAD_STOP: { case IOCTL_BCM_BUFFER_DOWNLOAD_STOP: {
if (!down_trylock(&Adapter->fw_download_sema)) {
up(&Adapter->fw_download_sema);
return -EINVAL;
}
if (down_trylock(&Adapter->NVMRdmWrmLock)) { if (down_trylock(&Adapter->NVMRdmWrmLock)) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
"FW download blocked as EEPROM Read/Write is in progress\n"); "FW download blocked as EEPROM Read/Write is in progress\n");
...@@ -867,11 +872,6 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -867,11 +872,6 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EACCES; return -EACCES;
} }
if (!down_trylock(&Adapter->fw_download_sema)) {
up(&Adapter->fw_download_sema);
return -EINVAL;
}
Adapter->bBinDownloaded = TRUE; Adapter->bBinDownloaded = TRUE;
Adapter->bCfgDownloaded = TRUE; Adapter->bCfgDownloaded = TRUE;
atomic_set(&Adapter->CurrNumFreeTxDesc, 0); atomic_set(&Adapter->CurrNumFreeTxDesc, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment