summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-08-02 04:33:34 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 20:58:49 +0200
commitb94badbb47cb50f4fca8440efdaa8ebd32604fe4 (patch)
treeab30562cdd55a5587bb596f23f443b3d8910a0e1
parentUSB: ark3116: Formatting cleanups (diff)
downloadlinux-b94badbb47cb50f4fca8440efdaa8ebd32604fe4.tar.xz
linux-b94badbb47cb50f4fca8440efdaa8ebd32604fe4.zip
USB: Make usb_buffer_free() NULL-safe
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>
-rw-r--r--drivers/usb/core/usb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 184c24660a4c..ab766e0fe4ef 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -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);
}