diff options
author | Jason Andryuk <jandryuk@gmail.com> | 2009-02-21 02:53:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:53:01 -0500 |
commit | 5a2137ddcc4b4d0d9227db433eabaefa3c3bd924 (patch) | |
tree | 3ca922c4dca135041ea9e6f9d0b6799660bbb2ee /drivers/net/wireless/at76c50x-usb.c | |
parent | deda862e699f0aba6f0975e138a0258d1b29f2df (diff) |
at76c50x-usb: clean up DMA on stack
Cleanup dma on stack issues:
- no DMA on stack
- cleanup unclear endianness issue
Corrected version of Oliver Neukum's original patch for at76_usb.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/at76c50x-usb.c')
-rw-r--r-- | drivers/net/wireless/at76c50x-usb.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index c79591ee2055..46ac9e278035 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -580,18 +580,25 @@ static int at76_remap(struct usb_device *udev) | |||
580 | static int at76_get_op_mode(struct usb_device *udev) | 580 | static int at76_get_op_mode(struct usb_device *udev) |
581 | { | 581 | { |
582 | int ret; | 582 | int ret; |
583 | u8 op_mode; | 583 | u8 saved; |
584 | u8 *op_mode; | ||
584 | 585 | ||
586 | op_mode = kmalloc(1, GFP_NOIO); | ||
587 | if (!op_mode) | ||
588 | return -ENOMEM; | ||
585 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, | 589 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, |
586 | USB_TYPE_VENDOR | USB_DIR_IN | | 590 | USB_TYPE_VENDOR | USB_DIR_IN | |
587 | USB_RECIP_INTERFACE, 0x01, 0, &op_mode, 1, | 591 | USB_RECIP_INTERFACE, 0x01, 0, op_mode, 1, |
588 | USB_CTRL_GET_TIMEOUT); | 592 | USB_CTRL_GET_TIMEOUT); |
593 | saved = *op_mode; | ||
594 | kfree(op_mode); | ||
595 | |||
589 | if (ret < 0) | 596 | if (ret < 0) |
590 | return ret; | 597 | return ret; |
591 | else if (ret < 1) | 598 | else if (ret < 1) |
592 | return -EIO; | 599 | return -EIO; |
593 | else | 600 | else |
594 | return op_mode; | 601 | return saved; |
595 | } | 602 | } |
596 | 603 | ||
597 | /* Load a block of the second ("external") part of the firmware */ | 604 | /* Load a block of the second ("external") part of the firmware */ |
@@ -704,21 +711,25 @@ static inline int at76_get_mib(struct usb_device *udev, u16 mib, void *buf, | |||
704 | /* Return positive number for status, negative for an error */ | 711 | /* Return positive number for status, negative for an error */ |
705 | static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd) | 712 | static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd) |
706 | { | 713 | { |
707 | u8 stat_buf[40]; | 714 | u8 *stat_buf; |
708 | int ret; | 715 | int ret; |
709 | 716 | ||
717 | stat_buf = kmalloc(40, GFP_NOIO); | ||
718 | if (!stat_buf) | ||
719 | return -ENOMEM; | ||
720 | |||
710 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22, | 721 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22, |
711 | USB_TYPE_VENDOR | USB_DIR_IN | | 722 | USB_TYPE_VENDOR | USB_DIR_IN | |
712 | USB_RECIP_INTERFACE, cmd, 0, stat_buf, | 723 | USB_RECIP_INTERFACE, cmd, 0, stat_buf, |
713 | sizeof(stat_buf), USB_CTRL_GET_TIMEOUT); | 724 | 40, USB_CTRL_GET_TIMEOUT); |
714 | if (ret < 0) | 725 | if (ret >= 0) |
715 | return ret; | 726 | ret = stat_buf[5]; |
727 | kfree(stat_buf); | ||
716 | 728 | ||
717 | return stat_buf[5]; | 729 | return ret; |
718 | } | 730 | } |
719 | 731 | ||
720 | #define MAKE_CMD_CASE(c) case (c): return #c | 732 | #define MAKE_CMD_CASE(c) case (c): return #c |
721 | |||
722 | static const char *at76_get_cmd_string(u8 cmd_status) | 733 | static const char *at76_get_cmd_string(u8 cmd_status) |
723 | { | 734 | { |
724 | switch (cmd_status) { | 735 | switch (cmd_status) { |
@@ -735,7 +746,7 @@ static const char *at76_get_cmd_string(u8 cmd_status) | |||
735 | return "UNKNOWN"; | 746 | return "UNKNOWN"; |
736 | } | 747 | } |
737 | 748 | ||
738 | static int at76_set_card_command(struct usb_device *udev, int cmd, void *buf, | 749 | static int at76_set_card_command(struct usb_device *udev, u8 cmd, void *buf, |
739 | int buf_size) | 750 | int buf_size) |
740 | { | 751 | { |
741 | int ret; | 752 | int ret; |