Skip to contentSkip to conversation

wl12xx: fix DMA-API-related warnings

DISCUSSION Dan Carpenter 3 participants 3 messages Apr 16, 2012 – Apr 19, 2012

lore
Share & tools
lore
#0 lore raw

Hello Mircea Gherzan,

The patch 690142e98826: "wl12xx: fix DMA-API-related warnings" from Mar 17, 2012, leads to the following Smatch warning:
drivers/net/wireless/ti/wlcore/cmd.c:126 wl1271_cmd_wait_for_event_or_timeout()
error: no modifiers for allocation.

static void wl1271_boot_fw_version(struct wl1271 *wl) {
- struct wl1271_static_data static_data;
+ struct wl1271_static_data *static_data;

- wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data),

+       static_data = kmalloc(sizeof(*static_data), GFP_DMA);
                                                    ^^^^^^^

You can't use GFP_DMA by itself like that, it needs to ORed with GFP_KERNEL or GFP_ATOMIC or something like that:

	static_data = kmalloc(sizeof(*static_data), GFP_KERNEL | GFP_DMA);

+ if (!static_data) {
+ __WARN();
+ return;

There are a couple other places in this patch which do the same thing. Could you fix it, please?

regards,
dan carpenter

#1 lore raw

Hi Luciano,

Am 16.04.2012 12:48, schrieb Dan Carpenter:

Quoted 6 lines

Hello Mircea Gherzan,

The patch 690142e98826: "wl12xx: fix DMA-API-related warnings" from Mar 17, 2012, leads to the following Smatch warning:
drivers/net/wireless/ti/wlcore/cmd.c:126 wl1271_cmd_wait_for_event_or_timeout()
error: no modifiers for allocation.

How would you prefer my fix for this issue: as a new version of the original patch or as a separate new patch?

Thanks,
Mircea

Quoted 23 lines

static void wl1271_boot_fw_version(struct wl1271 *wl) {

(quoted diff) +2 -2
-       struct wl1271_static_data static_data;
+       struct wl1271_static_data *static_data;
 
-       wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data),
+       static_data = kmalloc(sizeof(*static_data), GFP_DMA);
                                                    ^^^^^^^

You can't use GFP_DMA by itself like that, it needs to ORed with GFP_KERNEL or GFP_ATOMIC or something like that:

	static_data = kmalloc(sizeof(*static_data), GFP_KERNEL | GFP_DMA);
(quoted diff) +3 -0
+       if (!static_data) {
+               __WARN();
+               return;

There are a couple other places in this patch which do the same thing. Could you fix it, please?

regards,
dan carpenter

Signature · 1 line
Mircea
#2 lore raw

Hi Mircea,

Quoted 5 lines · Mircea Gherzan

Hi Luciano,

Am 16.04.2012 12:48, schrieb Dan Carpenter:

Quoted 2 lines

Hello Mircea Gherzan,

Quoted 7 lines
Quoted 4 lines

The patch 690142e98826: "wl12xx: fix DMA-API-related warnings" from Mar 17, 2012, leads to the following Smatch warning:
drivers/net/wireless/ti/wlcore/cmd.c:126 wl1271_cmd_wait_for_event_or_timeout()
error: no modifiers for allocation.

How would you prefer my fix for this issue: as a new version of the original patch or as a separate new patch?

I have already applied and pushed your patch, so send a separate new patch on top of it, please.

Actually, Dan already sent one fix, but it only fixes one place, I think we need to fix a couple more places too:

http://www.spinics.net/lists/linux-wireless/msg88626.html

Signature · 2 lines
Cheers,
Luca.