mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: remove NULL check for usb_kill_urb
@ 2023-01-11 10:02 Martin Kaiser
  2023-01-11 22:09 ` Philipp Hortmann
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kaiser @ 2023-01-11 10:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

usb_kill_urb handles a NULL parameter. There's no need for NULL checks
before we call usb_kill_urb.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
index 62106d2f82ad..583533631133 100644
--- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
@@ -29,8 +29,7 @@ void rtw_read_port_cancel(struct adapter *padapter)
 
 	for (i = 0; i < NR_RECVBUFF; i++) {
 		precvbuf->reuse = true;
-		if (precvbuf->purb)
-			usb_kill_urb(precvbuf->purb);
+		usb_kill_urb(precvbuf->purb);
 		precvbuf++;
 	}
 }
@@ -153,15 +152,13 @@ void rtw_write_port_cancel(struct adapter *padapter)
 	padapter->bWritePortCancel = true;
 
 	for (i = 0; i < NR_XMITBUFF; i++) {
-		if (pxmitbuf->pxmit_urb)
-			usb_kill_urb(pxmitbuf->pxmit_urb);
+		usb_kill_urb(pxmitbuf->pxmit_urb);
 		pxmitbuf++;
 	}
 
 	pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmit_extbuf;
 	for (i = 0; i < NR_XMIT_EXTBUFF; i++) {
-		if (pxmitbuf->pxmit_urb)
-			usb_kill_urb(pxmitbuf->pxmit_urb);
+		usb_kill_urb(pxmitbuf->pxmit_urb);
 		pxmitbuf++;
 	}
 }
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: r8188eu: remove NULL check for usb_kill_urb
  2023-01-11 10:02 [PATCH] staging: r8188eu: remove NULL check for usb_kill_urb Martin Kaiser
@ 2023-01-11 22:09 ` Philipp Hortmann
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Hortmann @ 2023-01-11 22:09 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 1/11/23 11:02, Martin Kaiser wrote:
> usb_kill_urb handles a NULL parameter. There's no need for NULL checks
> before we call usb_kill_urb.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
> index 62106d2f82ad..583533631133 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
> @@ -29,8 +29,7 @@ void rtw_read_port_cancel(struct adapter *padapter)
>   
>   	for (i = 0; i < NR_RECVBUFF; i++) {
>   		precvbuf->reuse = true;
> -		if (precvbuf->purb)
> -			usb_kill_urb(precvbuf->purb);
> +		usb_kill_urb(precvbuf->purb);
>   		precvbuf++;
>   	}
>   }
> @@ -153,15 +152,13 @@ void rtw_write_port_cancel(struct adapter *padapter)
>   	padapter->bWritePortCancel = true;
>   
>   	for (i = 0; i < NR_XMITBUFF; i++) {
> -		if (pxmitbuf->pxmit_urb)
> -			usb_kill_urb(pxmitbuf->pxmit_urb);
> +		usb_kill_urb(pxmitbuf->pxmit_urb);
>   		pxmitbuf++;
>   	}
>   
>   	pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmit_extbuf;
>   	for (i = 0; i < NR_XMIT_EXTBUFF; i++) {
> -		if (pxmitbuf->pxmit_urb)
> -			usb_kill_urb(pxmitbuf->pxmit_urb);
> +		usb_kill_urb(pxmitbuf->pxmit_urb);
>   		pxmitbuf++;
>   	}
>   }


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-11 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 10:02 [PATCH] staging: r8188eu: remove NULL check for usb_kill_urb Martin Kaiser
2023-01-11 22:09 ` Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®