ChangeSet 1.1474.81.4, 2004/01/06 14:19:28-08:00, david-b@pacbell.net [PATCH] USB: fix kfree in usb-skeleton.c >> if (dev->bulk_in_buffer != NULL) >> kfree (dev->bulk_in_buffer); > > > Yes that one check can go away. Care to send me a patch? Actually all those checks should go away ... drivers/usb/core/buffer.c | 2 ++ drivers/usb/usb-skeleton.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff -Nru a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c --- a/drivers/usb/core/buffer.c Tue Jan 20 17:37:31 2004 +++ b/drivers/usb/core/buffer.c Tue Jan 20 17:37:31 2004 @@ -127,6 +127,8 @@ struct usb_hcd *hcd = bus->hcpriv; int i; + if (!addr) + return; for (i = 0; i < HCD_BUFFER_POOLS; i++) { if (size <= pool_max [i]) { pci_pool_free (hcd->pool [i], addr, dma); diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c --- a/drivers/usb/usb-skeleton.c Tue Jan 20 17:37:31 2004 +++ b/drivers/usb/usb-skeleton.c Tue Jan 20 17:37:31 2004 @@ -205,14 +205,11 @@ */ static inline void skel_delete (struct usb_skel *dev) { - if (dev->bulk_in_buffer != NULL) - kfree (dev->bulk_in_buffer); - if (dev->bulk_out_buffer != NULL) - usb_buffer_free (dev->udev, dev->bulk_out_size, + kfree (dev->bulk_in_buffer); + usb_buffer_free (dev->udev, dev->bulk_out_size, dev->bulk_out_buffer, dev->write_urb->transfer_dma); - if (dev->write_urb != NULL) - usb_free_urb (dev->write_urb); + usb_free_urb (dev->write_urb); kfree (dev); }