diff options
author | Slark Xiao <slark_xiao@163.com> | 2022-06-22 09:21:13 +0300 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2022-06-22 09:56:52 +0300 |
commit | 7828466cff6b38c2a8ea7cc43958e3abe04342c2 (patch) | |
tree | 65b26b2ebab71b53ea74da7cc9a50af3ca20f4fd /drivers/usb/serial/garmin_gps.c | |
parent | a111daf0c53ae91e71fd2bfe7497862d14132e3e (diff) | |
download | linux-7828466cff6b38c2a8ea7cc43958e3abe04342c2.tar.xz |
USB: serial: use kmemdup instead of kmalloc + memcpy
For code neat purpose, we can use kmemdup to replace
kmalloc + memcpy.
Signed-off-by: Slark Xiao <slark_xiao@163.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/garmin_gps.c')
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index e5c75944ebb7..f1a8d8343623 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -988,7 +988,7 @@ static int garmin_write_bulk(struct usb_serial_port *port, garmin_data_p->flags &= ~FLAGS_DROP_DATA; spin_unlock_irqrestore(&garmin_data_p->lock, flags); - buffer = kmalloc(count, GFP_ATOMIC); + buffer = kmemdup(buf, count, GFP_ATOMIC); if (!buffer) return -ENOMEM; @@ -998,8 +998,6 @@ static int garmin_write_bulk(struct usb_serial_port *port, return -ENOMEM; } - memcpy(buffer, buf, count); - usb_serial_debug_data(&port->dev, __func__, count, buffer); usb_fill_bulk_urb(urb, serial->dev, |