ALSA: line6: Use kmemdup in podhd_set_monitor_level()
authorYueHaibing <yuehaibing@huawei.com>
Fri, 17 Jul 2020 08:17:10 +0000 (16:17 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Jul 2020 08:57:44 +0000 (10:57 +0200)
Use kmemdup rather than duplicating its implementation.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200717081710.39180-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/line6/podhd.c

index 1557483..eef45f7 100644 (file)
@@ -293,12 +293,10 @@ static void podhd_set_monitor_level(struct usb_line6_podhd *podhd, int value)
        };
        unsigned char *buf;
 
-       buf = kmalloc(sizeof(msg), GFP_KERNEL);
+       buf = kmemdup(msg, sizeof(msg), GFP_KERNEL);
        if (!buf)
                return;
 
-       memcpy(buf, msg, sizeof(msg));
-
        if (value < 0)
                value = 0;