2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00

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>
This commit is contained in:
Dmitry Torokhov 2006-08-01 22:33:34 -04:00 committed by Greg Kroah-Hartman
parent 988440e7e5
commit b94badbb47

View 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);
}