diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-10-26 15:06:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:23:27 -0500 |
commit | 5d7efe5b3768bf53df9b87380ea68baacf11f933 (patch) | |
tree | 57c1411ecd88c014acafe7ade94d4189b2c918e1 /drivers/usb/atm | |
parent | 052ac01aeb84d8427ba8ac3d70991ac01b009b59 (diff) |
USB: kmemdup() cleanup in drivers/usb/
replace open coded kmemdup() to save some screen space,
and allow inlining/not inlining to be triggered by gcc.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index f6b9f7e1f716..c137c041f7a4 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -401,9 +401,8 @@ static int uea_send_modem_cmd(struct usb_device *usb, | |||
401 | int ret = -ENOMEM; | 401 | int ret = -ENOMEM; |
402 | u8 *xfer_buff; | 402 | u8 *xfer_buff; |
403 | 403 | ||
404 | xfer_buff = kmalloc(size, GFP_KERNEL); | 404 | xfer_buff = kmemdup(buff, size, GFP_KERNEL); |
405 | if (xfer_buff) { | 405 | if (xfer_buff) { |
406 | memcpy(xfer_buff, buff, size); | ||
407 | ret = usb_control_msg(usb, | 406 | ret = usb_control_msg(usb, |
408 | usb_sndctrlpipe(usb, 0), | 407 | usb_sndctrlpipe(usb, 0), |
409 | LOAD_INTERNAL, | 408 | LOAD_INTERNAL, |
@@ -595,14 +594,12 @@ static int uea_idma_write(struct uea_softc *sc, void *data, u32 size) | |||
595 | u8 *xfer_buff; | 594 | u8 *xfer_buff; |
596 | int bytes_read; | 595 | int bytes_read; |
597 | 596 | ||
598 | xfer_buff = kmalloc(size, GFP_KERNEL); | 597 | xfer_buff = kmemdup(data, size, GFP_KERNEL); |
599 | if (!xfer_buff) { | 598 | if (!xfer_buff) { |
600 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); | 599 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); |
601 | return ret; | 600 | return ret; |
602 | } | 601 | } |
603 | 602 | ||
604 | memcpy(xfer_buff, data, size); | ||
605 | |||
606 | ret = usb_bulk_msg(sc->usb_dev, | 603 | ret = usb_bulk_msg(sc->usb_dev, |
607 | usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE), | 604 | usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE), |
608 | xfer_buff, size, &bytes_read, BULK_TIMEOUT); | 605 | xfer_buff, size, &bytes_read, BULK_TIMEOUT); |
@@ -765,12 +762,11 @@ static int uea_request(struct uea_softc *sc, | |||
765 | u8 *xfer_buff; | 762 | u8 *xfer_buff; |
766 | int ret = -ENOMEM; | 763 | int ret = -ENOMEM; |
767 | 764 | ||
768 | xfer_buff = kmalloc(size, GFP_KERNEL); | 765 | xfer_buff = kmemdup(data, size, GFP_KERNEL); |
769 | if (!xfer_buff) { | 766 | if (!xfer_buff) { |
770 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); | 767 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); |
771 | return ret; | 768 | return ret; |
772 | } | 769 | } |
773 | memcpy(xfer_buff, data, size); | ||
774 | 770 | ||
775 | ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), | 771 | ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), |
776 | UCDC_SEND_ENCAPSULATED_COMMAND, | 772 | UCDC_SEND_ENCAPSULATED_COMMAND, |