[06/13] staging: r8188eu: make rtl8188eu_inirp_init a void function

Message ID 20230108185738.597105-7-martin@kaiser.cx
State New
Headers
Series staging: r8188eu: some more xmit cleanups |

Commit Message

Martin Kaiser Jan. 8, 2023, 6:57 p.m. UTC
  rtl8188eu_inirp_init's return value is not checked by its caller. Make
rtl8188eu_inirp_init a void function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/usb_halinit.c  | 14 +++-----------
 drivers/staging/r8188eu/include/hal_intf.h |  2 +-
 2 files changed, 4 insertions(+), 12 deletions(-)
  

Comments

Pavel Skripkin Jan. 8, 2023, 7:57 p.m. UTC | #1
Hi Martin,

Martin Kaiser <martin@kaiser.cx> says:
> rtl8188eu_inirp_init's return value is not checked by its caller. Make
> rtl8188eu_inirp_init a void function.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/hal/usb_halinit.c  | 14 +++-----------
>   drivers/staging/r8188eu/include/hal_intf.h |  2 +-
>   2 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
> index d28b4dc2a767..afa24a59fbb3 100644
> --- a/drivers/staging/r8188eu/hal/usb_halinit.c
> +++ b/drivers/staging/r8188eu/hal/usb_halinit.c
> @@ -851,29 +851,21 @@ u32 rtl8188eu_hal_deinit(struct adapter *Adapter)
>   	return _SUCCESS;
>    }
>   
> -unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
> +void rtl8188eu_inirp_init(struct adapter *Adapter)

Hm, shouldn't we actually check return value on caller side?

This thing is called from netdev_open and issues urbs to read data from 
the device. So let's imagine that we fail on 1st iteration (for some 
reason): netdev_open() says all is OK, but driver does not communicate 
with the device.


Maybe these urbs are not that important, tho..


With regards,
Pavel Skripkin
  
Martin Kaiser Jan. 9, 2023, 9:24 p.m. UTC | #2
Hi Pavel,

Thus wrote Pavel Skripkin (paskripkin@gmail.com):

> Martin Kaiser <martin@kaiser.cx> says:

> > rtl8188eu_inirp_init's return value is not checked by its caller. Make
> > rtl8188eu_inirp_init a void function.

> Hm, shouldn't we actually check return value on caller side?

> This thing is called from netdev_open and issues urbs to read data from the
> device. So let's imagine that we fail on 1st iteration (for some reason):
> netdev_open() says all is OK, but driver does not communicate with the
> device.

your're right. It makes sense to relay the return value to _netdev_open.
We'd have to update/remove the intf_start pointer and usb_intf_start.

I'll resend the series without this patch and submit new patches for
relaying the error code.

Thanks & best regards,

   Martin
  

Patch

diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index d28b4dc2a767..afa24a59fbb3 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -851,29 +851,21 @@  u32 rtl8188eu_hal_deinit(struct adapter *Adapter)
 	return _SUCCESS;
  }
 
-unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
+void rtl8188eu_inirp_init(struct adapter *Adapter)
 {
 	u8 i;
 	struct recv_buf *precvbuf;
-	uint	status;
 	struct recv_priv *precvpriv = &Adapter->recvpriv;
 
-	status = _SUCCESS;
-
 	/* issue Rx irp to receive data */
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 	for (i = 0; i < NR_RECVBUFF; i++) {
-		if (!rtw_read_port(Adapter, (unsigned char *)precvbuf)) {
-			status = _FAIL;
-			goto exit;
-		}
+		if (!rtw_read_port(Adapter, (unsigned char *)precvbuf))
+			return;
 
 		precvbuf++;
 		precvpriv->free_recv_buf_queue_cnt--;
 	}
-
-exit:
-	return status;
 }
 
 /*  */
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index ac6e3f95c5b7..767f97c5f85d 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -26,7 +26,7 @@  void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level);
 int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter,
 				struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);
 
-unsigned int rtl8188eu_inirp_init(struct adapter *Adapter);
+void rtl8188eu_inirp_init(struct adapter *Adapter);
 
 uint rtw_hal_init(struct adapter *padapter);
 uint rtw_hal_deinit(struct adapter *padapter);