Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] watchdog: pcwd_usb: remove needless check before usb_free_coherent()
@ 2020-07-13  5:53 Xu Wang
  2020-07-19 14:01 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Wang @ 2020-07-13  5:53 UTC (permalink / raw)
  To: wim, linux, linux-watchdog; +Cc: linux-kernel, Xu Wang

usb_free_coherent() is safe with NULL usb_pcwd->intr_buffer and 
this check is not required.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/watchdog/pcwd_usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 2f44af1831d0..6726301ac02e 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -585,9 +585,8 @@ static struct notifier_block usb_pcwd_notifier = {
 static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
 {
 	usb_free_urb(usb_pcwd->intr_urb);
-	if (usb_pcwd->intr_buffer != NULL)
-		usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
-				  usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
+	usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
+			  usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
 	kfree(usb_pcwd);
 }
 
-- 
2.17.1


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

* Re: [PATCH] watchdog: pcwd_usb: remove needless check before usb_free_coherent()
  2020-07-13  5:53 [PATCH] watchdog: pcwd_usb: remove needless check before usb_free_coherent() Xu Wang
@ 2020-07-19 14:01 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-07-19 14:01 UTC (permalink / raw)
  To: Xu Wang; +Cc: wim, linux-watchdog, linux-kernel

On Mon, Jul 13, 2020 at 05:53:48AM +0000, Xu Wang wrote:
> usb_free_coherent() is safe with NULL usb_pcwd->intr_buffer and 
> this check is not required.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/pcwd_usb.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
> index 2f44af1831d0..6726301ac02e 100644
> --- a/drivers/watchdog/pcwd_usb.c
> +++ b/drivers/watchdog/pcwd_usb.c
> @@ -585,9 +585,8 @@ static struct notifier_block usb_pcwd_notifier = {
>  static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
>  {
>  	usb_free_urb(usb_pcwd->intr_urb);
> -	if (usb_pcwd->intr_buffer != NULL)
> -		usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
> -				  usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
> +	usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
> +			  usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
>  	kfree(usb_pcwd);
>  }
>  

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13  5:53 [PATCH] watchdog: pcwd_usb: remove needless check before usb_free_coherent() Xu Wang
2020-07-19 14:01 ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git