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

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

 



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@xxxxxxxxx>
---
 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

_______________________________________________
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