diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2015-09-28 17:18:43 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-29 03:18:50 +0200 |
commit | 26370228875b823b9a90562619c509461f9b91ae (patch) | |
tree | 23e49fd35168e6add07635a504701125890664a5 /drivers/staging/most | |
parent | staging: most: simplify code (diff) | |
download | linux-dev-26370228875b823b9a90562619c509461f9b91ae.tar.xz linux-dev-26370228875b823b9a90562619c509461f9b91ae.zip |
staging: most: prevent DMA on stack
This patch is needed to avoid having DMA on the stack.
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/hdm-usb/hdm_usb.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index 01ea91b0c6c5..7722212c8654 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -146,17 +146,23 @@ static void wq_netinfo(struct work_struct *wq_obj); * * This is reads data from INIC's direct register communication interface */ -static inline int drci_rd_reg(struct usb_device *dev, u16 reg, void *buf) +static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf) { - return usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), - DRCI_READ_REQ, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, - reg, - buf, - 2, - 5 * HZ); + int retval; + u16 *dma_buf = kzalloc(sizeof(u16), GFP_KERNEL); + u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE; + + if (!dma_buf) + return -ENOMEM; + + retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + DRCI_READ_REQ, req_type, + 0x0000, + reg, dma_buf, sizeof(u16), 5 * HZ); + *buf = *dma_buf; + kfree(dma_buf); + + return retval; } /** |