From: Dmitry Torokhov Date: Wed, 2 Aug 2006 02:33:34 +0000 (-0400) Subject: USB: Make usb_buffer_free() NULL-safe X-Git-Tag: v2.6.19-rc1~899^2~115 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b94badbb47cb50f4fca8440efdaa8ebd32604fe4;p=linux-2.6 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 184c24660a..ab766e0fe4 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); }