diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2013-10-14 12:29:34 -0400 |
|---|---|---|
| committer | Wim Van Sebroeck <wim@iguana.be> | 2013-11-17 13:37:48 -0500 |
| commit | 5412df0bda90a2bdcef2771849ad5472b9ef8100 (patch) | |
| tree | 6f6d0bd0b63757971222628dd10bd23307b54953 /drivers/watchdog | |
| parent | b1f9cd3225ae2e8626fe7503ae7be92240873049 (diff) | |
watchdog: pcwd_usb: Use allocated buffer for usb_control_msg
usb_control_msg() must use a dma-capable buffer.
This fixes the following error reported by smatch:
drivers/watchdog/pcwd_usb.c:257 usb_pcwd_send_command() error: doing dma on the
stack (buf)
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
| -rw-r--r-- | drivers/watchdog/pcwd_usb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 7b14d1847927..115a0ebebf4a 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
| @@ -235,13 +235,17 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, | |||
| 235 | unsigned char cmd, unsigned char *msb, unsigned char *lsb) | 235 | unsigned char cmd, unsigned char *msb, unsigned char *lsb) |
| 236 | { | 236 | { |
| 237 | int got_response, count; | 237 | int got_response, count; |
| 238 | unsigned char buf[6]; | 238 | unsigned char *buf; |
| 239 | 239 | ||
| 240 | /* We will not send any commands if the USB PCWD device does | 240 | /* We will not send any commands if the USB PCWD device does |
| 241 | * not exist */ | 241 | * not exist */ |
| 242 | if ((!usb_pcwd) || (!usb_pcwd->exists)) | 242 | if ((!usb_pcwd) || (!usb_pcwd->exists)) |
| 243 | return -1; | 243 | return -1; |
| 244 | 244 | ||
| 245 | buf = kmalloc(6, GFP_KERNEL); | ||
| 246 | if (buf == NULL) | ||
| 247 | return 0; | ||
| 248 | |||
| 245 | /* The USB PC Watchdog uses a 6 byte report format. | 249 | /* The USB PC Watchdog uses a 6 byte report format. |
| 246 | * The board currently uses only 3 of the six bytes of the report. */ | 250 | * The board currently uses only 3 of the six bytes of the report. */ |
| 247 | buf[0] = cmd; /* Byte 0 = CMD */ | 251 | buf[0] = cmd; /* Byte 0 = CMD */ |
| @@ -277,6 +281,8 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, | |||
| 277 | *lsb = usb_pcwd->cmd_data_lsb; | 281 | *lsb = usb_pcwd->cmd_data_lsb; |
| 278 | } | 282 | } |
| 279 | 283 | ||
| 284 | kfree(buf); | ||
| 285 | |||
| 280 | return got_response; | 286 | return got_response; |
| 281 | } | 287 | } |
| 282 | 288 | ||
