Skip to contentSkip to conversation

wlcore: fixup an allocation

PATCH In review Dan Carpenter 2 participants 2 messages Apr 17, 2012 – May 3, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wlcore: fixup an allocation

GFP_DMA isn't supposed to be used by itself. This allocation is allowed to sleep so it should be ORing it with GFP_KERNEL.
Also we should check for allocations errors.

---
I don't have the hardware to test this. Sorry.

drivers/net/wireless/ti/wlcore/cmd.c +3 -1
index 5c4716c..7ea10e1 100644
@@ -123,7 +123,9 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask)
 	unsigned long timeout;
 	int ret = 0;
 
-	events_vector = kmalloc(sizeof(*events_vector), GFP_DMA);
+	events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA);
+	if (!events_vector)
+		return -ENOMEM;
 
 	timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
 
#1 lore raw
Quoted 7 lines · Dan Carpenter

GFP_DMA isn't supposed to be used by itself. This allocation is allowed to sleep so it should be ORing it with GFP_KERNEL.
Also we should check for allocations errors.

---
I don't have the hardware to test this. Sorry.

Applied, thanks! I ran some very basic tests on it.