diff options
Diffstat (limited to 'sound/usb/quirks.c')
-rw-r--r-- | sound/usb/quirks.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 2e5bc7344026..a3ddac0deffd 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -137,12 +137,12 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
137 | return -ENOMEM; | 137 | return -ENOMEM; |
138 | } | 138 | } |
139 | if (fp->nr_rates > 0) { | 139 | if (fp->nr_rates > 0) { |
140 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); | 140 | rate_table = kmemdup(fp->rate_table, |
141 | sizeof(int) * fp->nr_rates, GFP_KERNEL); | ||
141 | if (!rate_table) { | 142 | if (!rate_table) { |
142 | kfree(fp); | 143 | kfree(fp); |
143 | return -ENOMEM; | 144 | return -ENOMEM; |
144 | } | 145 | } |
145 | memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates); | ||
146 | fp->rate_table = rate_table; | 146 | fp->rate_table = rate_table; |
147 | } | 147 | } |
148 | 148 | ||
@@ -224,10 +224,9 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
224 | if (altsd->bNumEndpoints != 1) | 224 | if (altsd->bNumEndpoints != 1) |
225 | return -ENXIO; | 225 | return -ENXIO; |
226 | 226 | ||
227 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 227 | fp = kmemdup(&ua_format, sizeof(*fp), GFP_KERNEL); |
228 | if (!fp) | 228 | if (!fp) |
229 | return -ENOMEM; | 229 | return -ENOMEM; |
230 | memcpy(fp, &ua_format, sizeof(*fp)); | ||
231 | 230 | ||
232 | fp->iface = altsd->bInterfaceNumber; | 231 | fp->iface = altsd->bInterfaceNumber; |
233 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | 232 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; |