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@xxxxxxxxx> --- drivers/staging/bcm/Bcmchar.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index f421b3b..b52c91e 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -837,6 +837,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"); @@ -844,11 +849,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); -- 1.7.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel