diff mbox series

watchdog: pcwd_usb: remove needless check before usb_free_coherent()

Message ID 20200713055348.21620-1-vulab@iscas.ac.cn (mailing list archive)
State Accepted
Headers show
Series watchdog: pcwd_usb: remove needless check before usb_free_coherent() | expand

Commit Message

Xu Wang July 13, 2020, 5:53 a.m. UTC
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(-)

Comments

Guenter Roeck July 19, 2020, 2:01 p.m. UTC | #1
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);
>  }
>
diff mbox series

Patch

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);
 }