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.rapop...@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 3adc112..024c4d4 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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to