Re: [RFT 2/2] cdc-wdm: fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, 27. April 2012, 17:33:26 schrieb Bjørn Mork:
> BTW, would it make sense to add a couple of debug messages to make it
> easier to follow the program flow here?  Something like this maybe?:
> 
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index da13bbc..b6010ae 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -623,10 +623,12 @@ static int wdm_release(struct inode *inode, struct file *file)
>         if (!desc->count) {
>                 dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
>                 kill_urbs(desc);
> -               if (!test_bit(WDM_DISCONNECTING, &desc->flags))
> +               if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
>                         desc->manage_power(desc->intf, 0);
> -               else
> +               } else {
> +                       dev_dbg(&desc->intf->dev, "%s: device gone - cleaning up\n", __func__);
>                         cleanup(desc);
> +               }
>         }
>         mutex_unlock(&wdm_mutex);
>         return 0;
> @@ -900,6 +902,8 @@ static void wdm_disconnect(struct usb_interface *intf)
>         mutex_unlock(&desc->rlock);
>         if (!desc->count)
>                 cleanup(desc);
> +       else
> +               dev_dbg(&intf->dev, "%s: %d open files - postponing cleanup\n", __func__, desc->count);
>         mutex_unlock(&wdm_mutex);
>  }
>  
> 

Looks good. Please submit a proper patch.

	Regards
		Oliver
-- 
- - - 
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
Maxfeldstraße 5                         
90409 Nürnberg 
Germany 
- - - 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux