staging: btmtk_usb: check for a valid io_buf pointer

assigned to retval of kmalloc but not checked whether the allocation failed or not,
fail the registering if allocation fail

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Devendra Naga 2013-05-25 23:04:16 -04:00 committed by Greg Kroah-Hartman
parent b8313417e5
commit cff2ae2185
1 changed files with 5 additions and 0 deletions

View File

@ -1597,6 +1597,11 @@ static int btmtk_usb_probe(struct usb_interface *intf,
}
data->io_buf = kmalloc(256, GFP_ATOMIC);
if (!data->io_buf) {
hci_free_dev(hdev);
kfree(data);
return -ENOMEM;
}
btmtk_usb_switch_iobase(data, WLAN);