[PATCH v2 09/11] staging: wilc1000: hif_ger_cfg: refactor error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check whether the driver is initialized before getting the semaphore
thus eliminating the need for WILC_ERRORREPORT and WILC_CATCH constructs
and s32Error variable.

Signed-off-by: Mike Rapoport <mike.rapoport@xxxxxxxxx>
---
 drivers/staging/wilc1000/host_interface.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 024c4d4..16a5d70 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6152,16 +6152,16 @@ s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal)
  */
 s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value)
 {
-	s32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
 
-	down(&(pstrWFIDrv->gtOsCfgValuesSem));
-
 	if (pstrWFIDrv == NULL) {
 		PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
-		WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+		return WILC_INVALID_ARGUMENT;
 	}
 	PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
+
+	down(&(pstrWFIDrv->gtOsCfgValuesSem));
+
 	switch (u16WID)	{
 
 	case WID_BSS_TYPE:
@@ -6242,10 +6242,7 @@ s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value)
 
 	up(&(pstrWFIDrv->gtOsCfgValuesSem));
 
-	WILC_CATCH(s32Error)
-	{
-	}
-	return s32Error;
+	return WILC_SUCCESS;
 
 }
 
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux