Skip to contentSkip to conversation

staging: wilc1000: remove pstrWFIDrv in host_int_set_mac_chnl_num

PATCH In review Chaehyun Lim 2 participants 6 messages Oct 5, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging: wilc1000: remove pstrWFIDrv in host_int_set_mac_chnl_num

This patch removes pstrWFIDrv variable in host_int_set_mac_chnl_num function. There is no need to make another variable to check if first arugment is NULL or not.
It is able to use wfi_drv directly that is first argument of this function.

---
 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -2
index 39d72ac..47ccaa8 100644
@@ -5318,10 +5318,9 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
 int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 {
 	int result = 0;
-	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)wfi_drv;
 	struct host_if_msg msg;
 
-	if (!pstrWFIDrv) {
+	if (!wfi_drv) {
 		PRINT_ER("driver is null\n");
 		return -EFAULT;
 	}
Signature · 1 line
2.6.0
#1 lore raw

PATCH 2/3 staging: wilc1000: return error code directly in host_int_set_mac_chnl_num

There is no need to pass the error code to the variable 'result'. Just return the error directly when error occurs. Return 0 at the end of this function when error is not happened.

---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index 47ccaa8..b1aa7dd 100644
@@ -5317,7 +5317,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
  */
 int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg msg;
 
 	if (!wfi_drv) {
@@ -5334,10 +5334,10 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 	result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
 	if (result) {
 		PRINT_ER("wilc mq send fail\n");
-		result = -EINVAL;
+		return -EINVAL;
 	}
 
-	return result;
+	return 0;
 }
 
 
Signature · 1 line
2.6.0
#2 lore raw

PATCH 3/3 staging: wilc1000: return error code direclty in host_int_wait_msg_queue_idle

In reply to Chaehyun Lim

There is no need to pass the error code to the variable 'result'. Just return the error directly when error occurs. Return 0 at the end of this function when error is not happened.

---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index b1aa7dd..427fbaa 100644
@@ -5343,7 +5343,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 
 int host_int_wait_msg_queue_idle(void)
 {
-	int result = 0;
+	int result;
 
 	struct host_if_msg msg;
 
@@ -5354,13 +5354,13 @@ int host_int_wait_msg_queue_idle(void)
 	result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
 	if (result) {
 		PRINT_ER("wilc mq send fail\n");
-		result = -EINVAL;
+		return -EINVAL;
 	}
 
 	/* wait untill MSG Q is empty */
 	down(&hWaitResponse);
 
-	return result;
+	return 0;
 }
 
 s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address)
Signature · 1 line
2.6.0
#3 lore raw

Re: [PATCH 3/3] staging: wilc1000: return error code direclty in host_int_wait_msg_queue_idle

Hi Chaehyun,

Quoted 3 lines · Chaehyun Lim

There is no need to pass the error code to the variable 'result'. Just return the error directly when error occurs. Return 0 at the end of this function when error is not happened.

We can't do this.

Quoted 20 lines
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -1
index b1aa7dd..427fbaa 100644
@@ -5343,7 +5343,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 
 int host_int_wait_msg_queue_idle(void)
 {
-       int result = 0;
+       int result;
 
        struct host_if_msg msg;
 

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5357

Quoted 5 lines
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -5354,13 +5354,13 @@ int host_int_wait_msg_queue_idle(void)
        result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
        if (result) {
                PRINT_ER("wilc mq send fail\n");
-               result = -EINVAL;
+               return -EINVAL;

Returning here means that we don't call down:

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5361

Quoted 4 lines
drivers/staging/wilc1000/host_interface.c +0 -0
        }
 
        /* wait untill MSG Q is empty */
        down(&hWaitResponse);

here.

Sorry for the confusion.

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
#4 lore raw

Re: [PATCH 3/3] staging: wilc1000: return error code direclty in host_int_wait_msg_queue_idle

Quoted 39 lines · Julian Calaby

Hi Chaehyun,

Quoted 3 lines · Chaehyun Lim

There is no need to pass the error code to the variable 'result'. Just return the error directly when error occurs. Return 0 at the end of this function when error is not happened.

We can't do this.

Quoted 20 lines
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -1
index b1aa7dd..427fbaa 100644
@@ -5343,7 +5343,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 
 int host_int_wait_msg_queue_idle(void)
 {
-       int result = 0;
+       int result;
 
        struct host_if_msg msg;
 

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5357

Quoted 5 lines
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -5354,13 +5354,13 @@ int host_int_wait_msg_queue_idle(void)
        result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
        if (result) {
                PRINT_ER("wilc mq send fail\n");
-               result = -EINVAL;
+               return -EINVAL;

Returning here means that we don't call down:

Quoted 2 lines
drivers/staging/wilc1000/host_interface.c +0 -0
        }
 
Quoted 9 lines

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5361

Quoted 2 lines
drivers/staging/wilc1000/host_interface.c +0 -0
        /* wait untill MSG Q is empty */
        down(&hWaitResponse);

here.

Sorry for the confusion.

Thanks,

Thank you for your comment. I also did not see what you're indicating.

regards
Chaehyun Lim

Quoted 5 lines

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

#5 lore raw

Re: [PATCH 3/3] staging: wilc1000: return error code direclty in host_int_wait_msg_queue_idle

Dear Greg

Please ignore this patch.

Thanks
Chaehyun Lim

Quoted 59 lines · Chaehyun Lim
Quoted 39 lines · Julian Calaby

Hi Chaehyun,

Quoted 3 lines · Chaehyun Lim

There is no need to pass the error code to the variable 'result'. Just return the error directly when error occurs. Return 0 at the end of this function when error is not happened.

We can't do this.

Quoted 20 lines
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -1
index b1aa7dd..427fbaa 100644
@@ -5343,7 +5343,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 
 int host_int_wait_msg_queue_idle(void)
 {
-       int result = 0;
+       int result;
 
        struct host_if_msg msg;
 

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5357

Quoted 5 lines
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -5354,13 +5354,13 @@ int host_int_wait_msg_queue_idle(void)
        result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
        if (result) {
                PRINT_ER("wilc mq send fail\n");
-               result = -EINVAL;
+               return -EINVAL;

Returning here means that we don't call down:

Quoted 2 lines
drivers/staging/wilc1000/host_interface.c +0 -0
        }
 
Quoted 9 lines

drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5361

Quoted 2 lines
drivers/staging/wilc1000/host_interface.c +0 -0
        /* wait untill MSG Q is empty */
        down(&hWaitResponse);

here.

Sorry for the confusion.

Thanks,

Thank you for your comment. I also did not see what you're indicating.

regards
Chaehyun Lim

Quoted 5 lines

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/