[PATCH] staging: btmtk_usb: check for a valid io_buf pointer
Devendra Naga
devendra.aaru at gmail.com
Sun May 26 03:04:16 UTC 2013
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 at gmail.com>
---
Hello,
Seems that kmalloc is called with GFP_ATOMIC flag
which is in registering stage, as since there wont be any interrupt context in this path,
may i change it to GFP_KERNEL in a subsequent patch?
Thanks
drivers/staging/btmtk_usb/btmtk_usb.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index 85bafac..ab57a4b 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -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);
--
1.7.11.7
More information about the devel
mailing list