diff mbox series

input: misc: remove needless check before usb_free_coherent()

Message ID 20200630063616.8060-1-vulab@iscas.ac.cn (mailing list archive)
State Superseded
Headers show
Series input: misc: remove needless check before usb_free_coherent() | expand

Commit Message

Xu Wang June 30, 2020, 6:36 a.m. UTC
From: Xu Wang <vulab@iscas.ac.cn>

usb_free_coherent() is safe with NULL addr and this check is
not required.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/input/misc/cm109.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Dmitry Torokhov July 7, 2020, 1:44 a.m. UTC | #1
Hi,

On Tue, Jun 30, 2020 at 06:36:16AM +0000, Chen Ni wrote:
> From: Xu Wang <vulab@iscas.ac.cn>
> 
> usb_free_coherent() is safe with NULL addr and this check is
> not required.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Even if you are passing on a patch created by someone else you still
need to add your "signed-off-by" to it. Please resubmit with both your
and Xu Wang's sign-offs.

> ---
>  drivers/input/misc/cm109.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
> index c09b9628ad34..e413801f0491 100644
> --- a/drivers/input/misc/cm109.c
> +++ b/drivers/input/misc/cm109.c
> @@ -663,12 +663,8 @@ static const struct usb_device_id cm109_usb_table[] = {
>  static void cm109_usb_cleanup(struct cm109_dev *dev)
>  {
>  	kfree(dev->ctl_req);
> -	if (dev->ctl_data)
> -		usb_free_coherent(dev->udev, USB_PKT_LEN,
> -				  dev->ctl_data, dev->ctl_dma);
> -	if (dev->irq_data)
> -		usb_free_coherent(dev->udev, USB_PKT_LEN,
> -				  dev->irq_data, dev->irq_dma);
> +	usb_free_coherent(dev->udev, USB_PKT_LEN, dev->ctl_data, dev->ctl_dma);
> +	usb_free_coherent(dev->udev, USB_PKT_LEN, dev->irq_data, dev->irq_dma);
>  
>  	usb_free_urb(dev->urb_irq);	/* parameter validation in core/urb */
>  	usb_free_urb(dev->urb_ctl);	/* parameter validation in core/urb */
> -- 
> 2.17.1
> 

Thanks.
diff mbox series

Patch

diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index c09b9628ad34..e413801f0491 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -663,12 +663,8 @@  static const struct usb_device_id cm109_usb_table[] = {
 static void cm109_usb_cleanup(struct cm109_dev *dev)
 {
 	kfree(dev->ctl_req);
-	if (dev->ctl_data)
-		usb_free_coherent(dev->udev, USB_PKT_LEN,
-				  dev->ctl_data, dev->ctl_dma);
-	if (dev->irq_data)
-		usb_free_coherent(dev->udev, USB_PKT_LEN,
-				  dev->irq_data, dev->irq_dma);
+	usb_free_coherent(dev->udev, USB_PKT_LEN, dev->ctl_data, dev->ctl_dma);
+	usb_free_coherent(dev->udev, USB_PKT_LEN, dev->irq_data, dev->irq_dma);
 
 	usb_free_urb(dev->urb_irq);	/* parameter validation in core/urb */
 	usb_free_urb(dev->urb_ctl);	/* parameter validation in core/urb */