1. 22 2月, 2017 3 次提交
    • T
      ALSA: usb-audio: Tidy up mixer_us16x08.c · 7086b7b3
      Takashi Iwai 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7086b7b3
    • T
      ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c · e2810d76
      Takashi Iwai 提交于
      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: d2bb390a ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
      Reported-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e2810d76
    • T
      ALSA: usb-audio: purge needless variable length array · 89b593c3
      Takashi Sakamoto 提交于
      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: d2bb390a ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      89b593c3
  2. 21 2月, 2017 2 次提交
  3. 20 2月, 2017 1 次提交