aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/bcm
diff options
context:
space:
mode:
authorKevin McKinney <klmckinney1@gmail.com>2011-11-27 20:51:47 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-29 10:09:52 +0900
commit19a177e6fb097c2a0dd94aeeb2805f0c04a4185f (patch)
treed766dd5c03e1a0652a05e0500aede459f40f0099 /drivers/staging/bcm
parentStaging: bcm: Alter code to move error handling closer to the calls. (diff)
downloadlinux-dev-19a177e6fb097c2a0dd94aeeb2805f0c04a4185f.tar.xz
linux-dev-19a177e6fb097c2a0dd94aeeb2805f0c04a4185f.zip
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: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r--drivers/staging/bcm/Bcmchar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 3b7c15039ee8..72a699c12704 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -860,6 +860,11 @@ cntrlEnd:
}
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)) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
"FW download blocked as EEPROM Read/Write is in progress\n");
@@ -867,11 +872,6 @@ cntrlEnd:
return -EACCES;
}
- if (!down_trylock(&Adapter->fw_download_sema)) {
- up(&Adapter->fw_download_sema);
- return -EINVAL;
- }
-
Adapter->bBinDownloaded = TRUE;
Adapter->bCfgDownloaded = TRUE;
atomic_set(&Adapter->CurrNumFreeTxDesc, 0);