Skip to content

Commit

Permalink
USB: Make usb_buffer_free() NULL-safe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Sep 27, 2006
1 parent 988440e commit b94badb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b94badb

Please sign in to comment.