mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-03 19:24:02 +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:
parent
988440e7e5
commit
b94badbb47
@ -762,6 +762,8 @@ void usb_buffer_free (
|
|||||||
{
|
{
|
||||||
if (!dev || !dev->bus || !dev->bus->op || !dev->bus->op->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);
|
dev->bus->op->buffer_free (dev->bus, size, addr, dma);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user