Commit 8aaedfaa authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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 ...
parent 8f39a4c6
...@@ -127,6 +127,8 @@ void hcd_buffer_free ( ...@@ -127,6 +127,8 @@ void hcd_buffer_free (
struct usb_hcd *hcd = bus->hcpriv; struct usb_hcd *hcd = bus->hcpriv;
int i; int i;
if (!addr)
return;
for (i = 0; i < HCD_BUFFER_POOLS; i++) { for (i = 0; i < HCD_BUFFER_POOLS; i++) {
if (size <= pool_max [i]) { if (size <= pool_max [i]) {
pci_pool_free (hcd->pool [i], addr, dma); pci_pool_free (hcd->pool [i], addr, dma);
......
...@@ -205,13 +205,10 @@ static inline void usb_skel_debug_data (const char *function, int size, const un ...@@ -205,13 +205,10 @@ static inline void usb_skel_debug_data (const char *function, int size, const un
*/ */
static inline void skel_delete (struct usb_skel *dev) static inline void skel_delete (struct usb_skel *dev)
{ {
if (dev->bulk_in_buffer != NULL)
kfree (dev->bulk_in_buffer); kfree (dev->bulk_in_buffer);
if (dev->bulk_out_buffer != NULL)
usb_buffer_free (dev->udev, dev->bulk_out_size, usb_buffer_free (dev->udev, dev->bulk_out_size,
dev->bulk_out_buffer, dev->bulk_out_buffer,
dev->write_urb->transfer_dma); dev->write_urb->transfer_dma);
if (dev->write_urb != NULL)
usb_free_urb (dev->write_urb); usb_free_urb (dev->write_urb);
kfree (dev); kfree (dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment