aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-09-07ALSA: 6fire: Use common error handling code in usb6fire_chip_probe()Markus Elfring1-18/+13
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-09-07ALSA: usx2y: Use common error handling code in submit_urbs()Markus Elfring1-8/+10
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-09-07ALSA: us122l: Use common error handling code in us122l_create_card()Markus Elfring1-4/+6
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-31ALSA: usx2y: Put missing KERN_CONT prefixTakashi Iwai1-2/+2
The usx2y driver has a debug printk code without proper KERN_ prefix. On recent kernels, KERN_CONT prefix is mandatory for continued output lines. Put it properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-31ALSA: usb-audio: Put missing KERN_CONT prefixTakashi Iwai1-2/+2
The usb-audio driver has a debug printk code without proper KERN_ prefix. On recent kernels, KERN_CONT prefix is mandatory for continued output lines. Put it properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23ALSA: usb-midi: Use common error handling code in __snd_usbmidi_create()Markus Elfring1-11/+11
Add jump targets so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22Merge branch 'for-linus' into for-nextTakashi Iwai4-3/+20
Conflicts: sound/core/control.c
2017-08-22ALSA: usb-audio: Add delay quirk for H650e/Jabra 550a USB headsetsJoakim Tjernlund1-3/+6
These headsets reports a lot of: cannot set freq 44100 to ep 0x81 and need a small delay between sample rate settings, just like Zoom R16/24. Add both headsets to the Zoom R16/24 quirk for a 1 ms delay between control msgs. Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19ALSA: usb: constify snd_pcm_ops structuresArvind Yadav7-9/+9
snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by <sound/pcm.h> work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-18ALSA: usb-audio: add DSD support for new Amanero PIDJussi Laako1-0/+4
Add DSD support for new Amanero Combo384 firmware version with a new PID. This firmware uses DSD_U32_BE. Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions") Signed-off-by: Jussi Laako <jussi@sonarnerd.net> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-18ALSA: usb-audio: don't retry snd_usb_ctl_msg after timeoutStephen Barber1-7/+13
A few calls to snd_usb_ctl_msg wrap the function in a retry loop. In the worst case, the timeout for snd_usb_ctl_msg is 5 seconds, which when retried 10 times (for example, if a device is removed) could cause a probe to hang for ~50 seconds. Example stack trace from 3.14 which triggered a hung task timeout: Call Trace: [<ffffffffa2c1f720>] ? inet6_set_link_af.part.35+0x12/0x12 [<ffffffffa2c20309>] schedule+0x6e/0x70 [<ffffffffa2c1f81c>] schedule_timeout+0xfc/0x13c [<ffffffffa2667bbc>] ? rcu_read_unlock_sched_notrace+0x17/0x17 [<ffffffffa2c20d68>] __wait_for_common+0x153/0x190 [<ffffffffa2c20d68>] ? __wait_for_common+0x153/0x190 [<ffffffffa26890e5>] ? wake_up_state+0x12/0x12 [<ffffffffa2c20e0e>] wait_for_completion_timeout+0x1d/0x1f [<ffffffffa2a07c70>] usb_start_wait_urb+0x93/0xf1 [<ffffffffa2a07daf>] usb_control_msg+0xe1/0x11d [<ffffffffc02cd254>] snd_usb_ctl_msg+0x9c/0xf1 [snd_usb_audio] [<ffffffffc02ce191>] snd_usb_mixer_set_ctl_value+0x124/0xab1 [snd_usb_audio] [<ffffffffc02ce230>] snd_usb_mixer_set_ctl_value+0x1c3/0xab1 [snd_usb_audio] [<ffffffffc02ce58e>] snd_usb_mixer_set_ctl_value+0x521/0xab1 [snd_usb_audio] [<ffffffffc02cee88>] snd_usb_mixer_add_control+0x36a/0x1264 [snd_usb_audio] [<ffffffffc02cf323>] snd_usb_mixer_add_control+0x805/0x1264 [snd_usb_audio] [<ffffffffa2a06e11>] ? usb_free_urb+0x1a/0x1c [<ffffffffc02cfcf7>] snd_usb_mixer_add_control+0x11d9/0x1264 [snd_usb_audio] [<ffffffffc02d000f>] snd_usb_create_mixer+0xbc/0x286 [snd_usb_audio] [<ffffffffc02cac18>] 0xffffffffc02cac17 [<ffffffffa2a0aaf1>] usb_probe_interface+0x17c/0x21c [<ffffffffa29a65bc>] driver_probe_device+0xae/0x1fa [<ffffffffa29a6767>] __device_attach_driver+0x5f/0x66 [<ffffffffa29a6708>] ? driver_probe_device+0x1fa/0x1fa [<ffffffffa29a4a60>] bus_for_each_drv+0x87/0xaa [<ffffffffa29a688a>] __device_attach+0x9d/0x101 [<ffffffffa29a6913>] device_initial_probe+0x13/0x15 [<ffffffffa29a5ae6>] bus_probe_device+0x33/0x96 [<ffffffffa29a3d19>] device_add+0x328/0x547 [<ffffffffa2a09355>] usb_set_configuration+0x624/0x674 [<ffffffffa2a11949>] generic_probe+0x45/0x77 [<ffffffffa2a0a962>] usb_probe_device+0x2d/0x40 [<ffffffffa29a65bc>] driver_probe_device+0xae/0x1fa [<ffffffffa29a6767>] __device_attach_driver+0x5f/0x66 [<ffffffffa29a6708>] ? driver_probe_device+0x1fa/0x1fa [<ffffffffa29a4a60>] bus_for_each_drv+0x87/0xaa [<ffffffffa29a688a>] __device_attach+0x9d/0x101 [<ffffffffa29a6913>] device_initial_probe+0x13/0x15 [<ffffffffa29a5ae6>] bus_probe_device+0x33/0x96 [<ffffffffa29a3d19>] device_add+0x328/0x547 [<ffffffffa29030bc>] ? add_device_randomness+0x111/0x130 [<ffffffffa2a00967>] usb_new_device+0x2a2/0x3c0 [<ffffffffa2a02ddc>] hub_thread+0xa3d/0xeed [<ffffffffa2c2010d>] ? __schedule+0x41e/0x5ac [<ffffffffa26957ce>] ? finish_wait+0x62/0x62 [<ffffffffa2a0239f>] ? usb_reset_device+0x16a/0x16a [<ffffffffa267b255>] kthread+0x108/0x110 [<ffffffffa267b14d>] ? __kthread_parkme+0x67/0x67 [<ffffffffa2c23b2c>] ret_from_fork+0x7c/0xb0 [<ffffffffa267b14d>] ? __kthread_parkme+0x67/0x67 Signed-off-by: Stephen Barber <smbarber@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devicesTakashi Iwai3-0/+9
C-Media devices (at least some models) mute the playback stream when volumes are set to the minimum value. But this isn't informed via TLV and the user-space, typically PulseAudio, gets confused as if it's still played in a low volume. This patch adds the new flag, min_mute, to struct usb_mixer_elem_info for indicating that the mixer element is with the minimum-mute volume. This flag is set for known C-Media devices in snd_usb_mixer_fu_apply_quirk() in turn. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196669 Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17ALSA: usb: make snd_pcm_hardware constBhumika Goyal1-1/+1
Make this const as it is only used in a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15ALSA: usb-audio: Apply sample rate quirk to Sennheiser headsetTakashi Iwai1-0/+1
A Senheisser headset requires the typical sample-rate quirk for avoiding spurious errors from inquiring the current sample rate like: usb 1-1: 2:1: cannot get freq at ep 0x4 usb 1-1: 3:1: cannot get freq at ep 0x83 The USB ID 1395:740a has to be added to the entries in snd_usb_get_sample_rate_quirk(). Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1052580 Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-12ALSA: usb: caiaq: audio: Delete two error messages for a failed memory allocation in alloc_urbs()Markus Elfring1-3/+0
Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. [Fixed the unused variable warning by this change as well -- tiwai] Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-12ALSA: usb: Delete an error message for a failed memory allocation in two functionsMarkus Elfring2-6/+3
Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-12ALSA: usx2y: Delete an error message for a failed memory allocation in two functionsMarkus Elfring1-6/+3
Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: usbusx2y: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: us122l: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: ua101: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: usb-audio: constify usb_device_id.Arvind Yadav1-2/+2
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: snd-usb-caiaq: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: bcd2000: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-06ALSA: 6fire: constify usb_device_id.Arvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-20ALSA: line6: remove unnecessary initialization to PODHD500XHans P. Möller Ebner2-4/+8
Remove Initialization from POD HD500X because it's not needed. Every time the device is connected dmesg gives the following output: "receive length failed (error -11)". To solve this problem, another flags is introduced (LINE6_CAP_CONTROL_INFO) and it is only used for PODX3 in: sysfs entries, call podhd_startup_finalize(pod) and disconnection. With this patch the error disappear. Signed-off-by: Hans P. Moller <hmoller@uc.cl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-20ALSA: line6: add support for POD HD500XHans P. Möller Ebner1-1/+16
Add support for the Line6 POD HD500X multi effect processor for playback and capture (in/out audio) through USB. Signed-off-by: Hans P. Moller <hmoller@uc.cl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-07Merge branch 'for-linus' into for-nextTakashi Iwai1-7/+12
For applying more ALSA timer cleanups.
2017-05-31ALSA: usb: Avoid VLA in mixer_us16x08.cTakashi Iwai1-3/+8
This is another attempt to work around the VLA used in mixer_us16x08.c. Basically the temporary array is used individually for two cases, and we can declare locally in each block, instead of hackish max() usage. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-31ALSA: usb: Fix a typo in Tascam US-16x08 mixer elementTakashi Iwai1-1/+1
A mixer element created in a quirk for Tascam US-16x08 contains a typo: it should be "EQ MidLow Q" instead of "EQ MidQLow Q". Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195875 Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk") Cc: <stable@vger.kernel.org> # v4.11+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-31Revert "ALSA: usb-audio: purge needless variable length array"Takashi Iwai1-4/+4
This reverts commit 89b593c30e83 ("ALSA: usb-audio: purge needless variable length array"). The patch turned out to cause a severe regression, triggering an Oops at snd_usb_ctl_msg(). It was overseen that snd_usb_ctl_msg() writes back the response to the given buffer, while the patch changed it to a read-only const buffer. (One should always double-check when an extra pointer cast is present...) As a simple fix, just revert the affected commit. It was merely a cleanup. Although it brings VLA again, it's clearer as a fix. We'll address the VLA later in another patch. Fixes: 89b593c30e83 ("ALSA: usb-audio: purge needless variable length array") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195875 Cc: <stable@vger.kernel.org> # v4.11+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-30ALSA: declare snd_kcontrol_new structures as constBhumika Goyal1-1/+1
Declare snd_kcontrol_new structures as const as they are only passed an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having this property can be made const. Done using Coccinelle: @r disable optional_qualifier@ identifier x; position p; @@ static struct snd_kcontrol_new x@p={...}; @ok@ identifier r.x; position p; @@ snd_ctl_new1(&x@p,...) @bad@ position p != {r.p,ok.p}; identifier r.x; @@ x@p @depends on !bad disable optional_qualifier@ identifier r.x; @@ +const struct snd_kcontrol_new x; Cross compiled these files: sound/aoa/codecs/tas.c - powerpc sound/mips/{hal2.c/sgio2audio.c} - mips sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc sound/soc/sh/siu_dai.c - sh Could not find an architecture to compile sound/sh/aica.c. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-15ALSA: us122l: enable compile testingJohan Hovold1-1/+1
This USB driver currently depends on X86 for some undocumented reason. Since it compiles just fine for arm, we can at least enable compile testing. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-15ALSA: us122l: clean up US144 handlingJohan Hovold2-18/+20
Use the device-id table and a private flag to determine the device type (US122 or US144) rather than spreading product-id conditionals throughout the driver. This USB driver currently depends on X86 (why?), but we should still add the missing endianness conversions when accessing the USB device-descriptor fields. Compile-tested only. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-15ALSA: usb-audio: fix Amanero Combo384 quirk on big-endian hostsJohan Hovold1-1/+1
Add missing endianness conversion when using the USB device-descriptor bcdDevice field when applying the Amanero Combo384 (endianness!) quirk. Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions") Cc: Jussi Laako <jussi@sonarnerd.net> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-17ALSA: usb-audio: replace /proc/bus/usb by /dev/bus/usbMauro Carvalho Chehab3-3/+3
The /proc/bus/usb devices don't exist anymore, since when we got rid of usbfs. Those devices are now seen at /dev/bus/usb. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-14ALSA: usb-line6: constify snd_kcontrol_new strucutre arrayTakashi Sakamoto1-1/+1
In kernel APIs of ALSA control interface, drivers can create a control element set by a call of snd_ctl_new1() with a template. This template is known to have const qualifier in general cases. This commit adds the qualifier to template array, for safer program and runtime. Application of this change moves the symbol from .data section to .rodata section. Cc: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-12ALSA: line6: constify snd_kcontrol_new structuresBhumika Goyal2-3/+3
Declare snd_kcontrol_new strcutures as const as they are only passed as an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having this property can be made const too. Done using Coccinelle: @r disable optional_qualifier@ identifier x; position p; @@ static struct snd_kcontrol_new x@p={...}; @ok@ identifier r.x; position p; @@ snd_ctl_new1(&x@p,...) @bad@ position p != {r.p,ok.p}; identifier r.x; @@ x@p @depends on !bad disable optional_qualifier@ identifier r.x; @@ +const struct snd_kcontrol_new x; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-12ALSA: usb-audio: constify snd_kcontrol_new structuresBhumika Goyal2-4/+4
Declare snd_kcontrol_new strcutures as const as they are only passed as an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having this property can be made const too. Done using Coccinelle: @r disable optional_qualifier@ identifier x; position p; @@ static struct snd_kcontrol_new x@p={...}; @ok@ identifier r.x; position p; @@ snd_ctl_new1(&x@p,...) @bad@ position p != {r.p,ok.p}; identifier r.x; @@ x@p @depends on !bad disable optional_qualifier@ identifier r.x; @@ +const struct snd_kcontrol_new x; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31ALSA: usb-audio: Fake also USB device id when alias is givenTakashi Iwai1-3/+3
Recently snd-usb-audio driver received a new option, quirk_alias, to allow user to apply the existing quirk for a different device. This works for many quirks as is, but some still need more tune-ups: namely, some quirks check the USB vendor/device IDs in various places, thus it doesn't work as long as the ID is different from the expected one. With this patch, the driver stores the aliased USB ID, so that these rest quirks per device ID are applied. The transition to use the cached USB ID was already done in the past, so what we needed now is only to overwrite chip->usb_id. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-20Merge branch 'topic/for-4.12' into for-nextTakashi Iwai1-6/+6
2017-02-24mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmfDave Jiang3-10/+7
->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to take a vma and vmf parameter when the vma already resides in vmf. Remove the vma parameter to simplify things. [arnd@arndb.de: fix ARM build] Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Jan Kara <jack@suse.com> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-22ALSA: usb-audio: Tidy up mixer_us16x08.cTakashi Iwai1-82/+50
A few more cleanups and improvements that have been overlooked: - Use ARRAY_SIZE() macro appropriately - Code shuffling for minor optimization - Omit superfluous variable initializations - Get rid of superfluous NULL checks - Add const to snd_us16x08_control_params definitions No functional changes. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-22ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.cTakashi Iwai2-54/+39
There are a few places leaking memory and doing double-free in mixer_us16x08.c. The driver allocates a usb_mixer_elem_info object at each add_new_ctl() call. This has to be freed via kctl->private_free, but currently this is done properly only for some controls. Also, the driver allocates three external objects (comp_store, eq_store, meter_store), and these are referred in elem->private_data (it's not kctl->private_data). And these have to be released, but there are none doing it. Moreover, these extra objects have to be released only once. Thus the release should be done only by the first kctl element that refers to it. For fixing these, we call either snd_usb_mixer_elem_free() (only for kctl->private_data) or elem_private_free() (for both kctl->private_data and elem->private_data) via kctl->private_free appropriately. Last but not least, snd_us16x08_controls_create() may return in the middle without releasing the allocated *_store objects due to an error. For fixing this, we shuffle the allocation code so that it's called just before its reference. Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk") Reported-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-22ALSA: usb-audio: purge needless variable length arrayTakashi Sakamoto1-4/+4
Variable length array is used in 'snd_us16x08_meter_get()', while there is no need. It's better to purge it because variable length array has overhead for stack handling. This commit replaces the array with static length. Sparse generated below warning. sound/usb/mixer_us16x08.c:714:18: warning: Variable length array is used. Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-21ALSA: usb-audio: constify snd_kcontrol_new structuresBhumika Goyal1-6/+6
Declare snd_kcontrol_new structures as const as they are only passed as an argument to the function add_new_ctl. This agrument is of type const, so snd_kcontrol_new structures having this property can be made const too. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-20ALSA: usb-audio: localize function without external linkageTakashi Sakamoto1-1/+1
When accessed inner a file, functions should have static qualifier for local-linkage. This commit fixes the bug. Sparse generated below warning. sound/usb/mixer_us16x08.c:1043:32: warning: symbol 'snd_us16x08_create_meter_store' was not declared. Should it be static? Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-20ALSA: usb-audio: localize one-referrer variableTakashi Sakamoto1-1/+1
When accessed by one referrer inner a file, variables should have static qualifier to declare local-linkage. This commit fixes the bug. Sparse generated below warnings. sound/usb/mixer_us16x08.c:156:13: warning: duplicate const sound/usb/mixer_us16x08.c:156:18: warning: symbol 'route_names' was not declared. Should it be static? Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-20ALSA: usb-audio: Tascam US-16x08 DSP mixer quirkDetlef Urban4-0/+1593
Add mixer quirk for Tascam US-16x08 usb interface. Even that this is an usb compliant device, the input channels and DSP functions (EQ/Compressor) aren't accessible by default. Signed-off-by: Detlef Urban <onkel@paraair.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-07ALSA: line6: Always setup isochronous transfer propertiesAndrej Krutak1-22/+26
While not all line6 devices currently support PCM, it causes no harm to 'have it prepared'. This also fixes toneport, which only has PCM - in which case we previously skipped the USB transfer properties detection completely. Signed-off-by: Andrej Krutak <dev@andree.sk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-07Merge branch 'for-linus' into for-nextTakashi Iwai1-1/+2