]> err.no Git - linux-2.6/commitdiff
USB: Make usb_buffer_free() NULL-safe
authorDmitry Torokhov <dtor@insightbb.com>
Wed, 2 Aug 2006 02:33:34 +0000 (22:33 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 27 Sep 2006 18:58:49 +0000 (11:58 -0700)
kfree() handles NULL arguments which is handy in error handling paths as one
does need to  insert bunch of ifs. How about making usb_buffer_free() do the
same?

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/usb.c

index 184c24660a4c572b89fd4175d24314dd1fcb8f6c..ab766e0fe4ef3a6532a2efdea8d5452974cd0ee6 100644 (file)
@@ -761,7 +761,9 @@ void usb_buffer_free (
 )
 {
        if (!dev || !dev->bus || !dev->bus->op || !dev->bus->op->buffer_free)
-               return;
+               return;
+       if (!addr)
+               return;
        dev->bus->op->buffer_free (dev->bus, size, addr, dma);
 }