Commit 8fbebb09 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman

Staging: bcm: Alter code to move error handling closer to the calls.

This is a cleanup patch. I've shuffled the code around to
move the error handling closer to the calls. I've removed
some indent levels. I've replaced break statements with
direct returns.
Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fef5675e
......@@ -765,7 +765,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
"Starting the firmware download PID =0x%x!!!!\n", current->pid);
if (!down_trylock(&Adapter->fw_download_sema)) {
if (down_trylock(&Adapter->fw_download_sema))
return -EBUSY;
Adapter->bBinDownloaded = FALSE;
Adapter->fw_download_process_pid = current->pid;
Adapter->bCfgDownloaded = FALSE;
......@@ -777,15 +779,12 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
pr_err(PFX "%s: reset_card_proc Failed!\n", Adapter->dev->name);
up(&Adapter->fw_download_sema);
up(&Adapter->NVMRdmWrmLock);
break;
return Status;
}
mdelay(10);
} else {
Status = -EBUSY;
}
up(&Adapter->NVMRdmWrmLock);
break;
return Status;
}
case IOCTL_BCM_BUFFER_DOWNLOAD: {
......@@ -797,7 +796,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
"Invalid way to download buffer. Use Start and then call this!!!\n");
up(&Adapter->fw_download_sema);
Status = -EINVAL;
break;
return Status;
}
/* Copy Ioctl Buffer structure */
......@@ -832,7 +831,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
psFwInfo->u32FirmwareLength);
up(&Adapter->fw_download_sema);
Status = -EINVAL;
break;
return Status;
}
Status = bcm_ioctl_fw_download(Adapter, psFwInfo);
......@@ -857,7 +856,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "IOCTL: Firmware File Uploaded\n");
kfree(psFwInfo);
break;
return Status;
}
case IOCTL_BCM_BUFFER_DOWNLOAD_STOP: {
......@@ -868,7 +867,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EACCES;
}
if (down_trylock(&Adapter->fw_download_sema)) {
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);
......@@ -882,7 +885,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Firm Download Failed\n");
up(&Adapter->fw_download_sema);
up(&Adapter->NVMRdmWrmLock);
break;
return Status;
} else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL, "Firm Download Over...\n");
......@@ -914,13 +917,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if (!timeout)
Status = -ENODEV;
} else {
Status = -EINVAL;
}
up(&Adapter->fw_download_sema);
up(&Adapter->NVMRdmWrmLock);
break;
return Status;
}
case IOCTL_BE_BUCKET_SIZE:
......
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