[PATCH 08/13] staging: wilc1000: Handle_Scan: refactor error handling

Mike Rapoport mike.rapoport at gmail.com
Mon Sep 14 19:00:50 UTC 2015


In case SendConfigPkt fails, the error handling code performs deletion of
timer, calls Handle_ScanDone and falls through freeing of allocated memory
which is common for both success and error paths. The deletion of timer and
invocation of Handle_ScanDone can be performed in 'then' clause of check of
SendConfigPkt return value, thus eliminating the need for goto (wrapped in
WILC_ERRORREPORT) and label (wrapped in WILC_CATCH).

Signed-off-by: Mike Rapoport <mike.rapoport at gmail.com>
---
 drivers/staging/wilc1000/host_interface.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 8dd8034..4a6effd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1386,16 +1386,11 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHost
 
 	if (s32Error) {
 		PRINT_ER("Failed to send scan paramters config packet\n");
-		WILC_ERRORREPORT(s32Error, s32Error);
-	} else {
-		PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n");
-	}
-
-	WILC_CATCH(s32Error)
-	{
 		del_timer(&pstrWFIDrv->hScanTimer);
 		/*if there is an ongoing scan request*/
 		Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED);
+	} else {
+		PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n");
 	}
 
 	/* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */
-- 
2.1.0



More information about the devel mailing list