speedtch usbatm.h,1.4,1.5 usbatm2.c,1.13,1.14
Roman Kagan
rkagan at mail.ru
Mon Feb 7 04:15:53 EST 2005
Hi Duncan,
On Wed, Feb 02, 2005 at 11:23:50PM +0300, Roman Kagan wrote:
> Still, to complete the experiment with the asynchronous heavy_init
> kthread shutdown (and to keep you busy reviewing :) I've made up the
> patch below against current CVS.
Another reminder of how easy it is to get refcounting wrong :(
Here's an incremental patch fixing three memleaks, two of them being
present in the synchronous version too: 1) extra refcount increment and
2) need to call subdriver's ->unbind if ->bind succeeded but there was a
failure later on in usbatm_usb_probe, since usbatm_usb_disconnect won't
be called in this case.
I'll be sending a complete async patch vs current CVS in a minute.
Cheers,
Roman.
diff -u usbatm.c usbatm.c
--- usbatm.c 2 Feb 2005 20:22:27 -0000
+++ usbatm.c 7 Feb 2005 02:54:25 -0000
@@ -1068,7 +1068,7 @@
memset(instance, 0, sizeof(*instance));
- kref_init(&instance->refcount); /* one for USB */
+ kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */
init_MUTEX(&instance->serialize);
@@ -1188,11 +1188,15 @@
else
error = usbatm_atm_init(instance);
- if (error)
+ if (error) {
+ if (instance->driver->unbind)
+ instance->driver->unbind(instance, intf);
+
+ usbatm_put_sub_instance(instance);
goto fail;
+ }
usb_get_dev(dev);
- usbatm_get_instance(instance); /* dropped in usbatm_usb_disconnect */
usb_set_intfdata(intf, instance);
return 0;
More information about the Usbatm
mailing list