Check that the result of kzalloc is not NULL before a dereference.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc\)(...);
... when != x == NULL
when != x != NULL
when != (x || ...)
(
kfree(x)
|
f(...,C,...,x,...)
|
*f(...,x,...)
|
*x->f
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The name buf with size 16 is too short for some codec names, e.g.
truncated like "ALC861-VD Analo". Now the size is doubled.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
mpu_synth_info[m].name is a char[30], and the minimum length of the data
written by sprintf is 31 bytes including terminating null.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
DSPVersion is declared as char[3], but the sprintf writes at least 4 bytes
including terminating null.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e->sad[] is declared with size ELD_MAX_SAD=16, but the guard
allows range 0-31.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* fix/hda:
ALSA: hda - Fix mute control with some ALC262 models
ALSA: hda - Restore GPIO1 properly at resume with AD1984A
ALSA: hda - Use snprintf() to be safer
The master mute switch is wrongly implemented as checking the pointer
instead of its value, thus it can be never muted. This patch fixes
the issue.
Reference: Novell bnc#404873
https://bugzilla.novell.com/show_bug.cgi?id=404873
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
This adds support for Native Instrument's freshly announced Audio2DJ
sound device hardware. Version number bumped to 1.3.19.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The fix 79452f0a28 introduced another
bug due to the missing offset for the overlapped hwptr.
When the hwptr goes back to zero, the delta value has to be corrected
with the buffer size. Otherwise this causes looping sounds.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added the logging functionality to xrun_debug to record the hwptr
updates via snd_pcm_update_hw_ptr() and snd_pcm_update_hwptr_interrupt(),
corresponding to 16 and 8, respectively.
For example,
# echo 9 > /proc/asound/card0/pcm0p/xrun_debug
will record the position and other parameters at each period interrupt
together with the normal XRUN debugging.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
PLL was not being enabled when it was not bypassed. This patch
enables the PLL when it is used. Additionally, it disables the PLL
when it is bypassed.
Without this patch, the audio on TI DM646x EVM and DM355 EVM
does not work properly. The bit clocks and the frame sync signals
from the codec are not correct and hence the playback/record are faster
than usual for most sample rates. The reason for this was that the PLL
was not enabled when it was not bypassed.
Tested on DM6467 EVM, playback tested on DM355 EVM.
Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The commit 099db17e66 introduced a
regression at suspend/resume where the GPIO1 bit isn't properly
restored, thus the speaker output gets muted initially after resume.
The fix is simple, use the cached write for storing GPIO data.
Reference: Novell bnc#522764
https://bugzilla.novell.com/show_bug.cgi?id=522764
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix a few uninitialized error checks that were introduced recently
mistakenlly during the clean-up:
sound/pci/ctxfi/ctamixer.c: In function ‘get_amixer_rsc’:
sound/pci/ctxfi/ctamixer.c:261: warning: ‘err’ may be used uninitialized in this function
sound/pci/ctxfi/ctamixer.c: In function ‘get_sum_rsc’:
sound/pci/ctxfi/ctamixer.c:415: warning: ‘err’ may be used uninitialized in this function
sound/pci/ctxfi/ctsrc.c: In function ‘get_srcimp_rsc’:
sound/pci/ctxfi/ctsrc.c:742: warning: ‘err’ may be used uninitialized in this function
Signed-off-by: Takashi Iwai <tiwai@suse.de>
- E3500 report cval->max more than it actually can handel, so if you
set 95% capture level it will be silently muted.
- Betwen cval->min and cval-max(real) is 2940 control units,
but real are only 7 with cval->res = 384.
- Alsa can't handel less than 10 controls, so make it more
and set cval->res = 192.
Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
VMware tends to report PCM positions and period updates at utterly
wrong timing. This screws up the recent PCM core code that tries
to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update
instead of rebasing. (This is almost the old behavior before
2.6.30.)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* fix/misc:
ALSA: ca0106 - Fix the max capture buffer size
ALSA: OSS sequencer should be initialized after snd_seq_system_client_init
ALSA: sound/isa: convert nested spin_lock_irqsave to spin_lock
* fix/hda:
ALSA: hda - Fix pin-setup for Sony VAIO with STAC9872 codecs
ALSA: hda - Add quirk for Gateway T6834c laptop
ALSA: hda_codec: Check for invalid zero connections
On Soundblaster X-FI Titanium with emu20k2 the SIDE and SURROUND
channels were swapped and wrong.
I double checked it with connector colors and creative soundblaster
windows drivers.
So I swapped them to the true order.
Now "speaker-test -c6" and "speaker-test -c8" are working fine.
Signed-off-by: Frank Roth <frashman@freenet.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The capture buffer size with 64kB seems broken with CA0106.
At least, either the update timing or the DMA position is wrong,
and this screws up pulseaudio badly.
This patch restricts the max buffer size less than that to make life
a bit easier.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
The recent rewrite of the codec parser for STAC9872 caused a regression
for some Sony VAIO models that don't give proper pin default configs
by BIOS. Even using model=vaio doesn't work because the pin definitions
are set after the pin overrides.
This patch fixes the pin definitions in patch_stac9872() to be put
in the right place before the pin overrides. Also the patch adds the
new quirk entry for VAIO F/S to have the correct pin default configs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
Gateway T6834c laptops need EAPD always on while the default behavior
for the STAC9205 reference board is to turn it off upon every HP plug.
By using the special "eapd" model, which is first introduced for Gateway
T1616 laptops for this same reason, this peculiarity can be properly
handled.
Signed-off-by: Hao Song <baritono.tux@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
If spin_lock_irqsave is called twice in a row with the same second
argument, the interrupt state at the point of the second call overwrites
the value saved by the first call. Indeed, the second call does not need
to save the interrupt state, so it is changed to a simple spin_lock.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
expression lock1,lock2;
expression flags;
@@
*spin_lock_irqsave(lock1,flags)
... when != flags
*spin_lock_irqsave(lock2,flags)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To prevent "Too many connections" message and the error path for some HDMI
codecs (which makes onboard audio unusable), check for invalid zero
connections for CONNECT_LIST verb.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We need to check returning error for pci_register_driver(&joystick_driver)
On failure, we should unregister formerly registered audio drivers
This also fixed the compiler warning :
CC [M] sound/pci/riptide/riptide.o
sound/pci/riptide/riptide.c: In function ‘alsa_card_riptide_init’:
sound/pci/riptide/riptide.c:2200: warning: ignoring return value of ‘__pci_register_driver’, declared with attribute warn_unused_result
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Blue Microphones USB devices have an alternate setting that sends two
channels of data to the computer. Unfortunately, the descriptors of
that altsetting have a wrong channel setting, which means that any
recorded data from such a device has twice the sample rate from what
would be expected.
This patch adds a workaround to ignore that altsetting. Since these
devices have only one actual channel, no data is lost.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is the last in-kernel direct usage of driver_data, replace it with
the proper dev_get/set_drvdata() calls.
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
On some IbexPeak systems with ALC889A errors like "azx_get_response
timeout, switching to polling mode: last cmd=0xaf9f000b" are produced,
because non-existent codec #10 is wrongly accessed.
The problem is that snd_hda_get_connections() returns out-of-range result
for NID 0x1c (something like 0xf8f9 or 0xffff).
This patch adds a check to alc880_parse_auto_config() to avoid using
of this out-of-range NIDs. A better fix maybe to improve
snd_hda_get_connections() routine to check for valid NID ranges if
NIDs are expected as result.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* fix/asoc:
ASoC: Fix wm8753 register cache size and initialization
ASoC: add locking to mpc5200-psc-ac97 driver
ASoC: Fix mpc5200-psc-ac97 to ensure the data ready bit is cleared
ASoC: Fix register cache initialisation for WM8753
Simplify ALC882_TARGA and return gpio3 to ALC883_TARGA_DIG and
ALC883_TARGA_2ch_DIG, which I accidentally removed in commit id
64a8be7435
Signed-off-by: David Heidelberger <d.okias@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Check for rtd->params->drcmr != NULL before accessing it.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
In the beep tone calculation for IDT/STAC codecs, lower numbers correspond
to higher frequencies and vice versa. The current code has this backwards,
resulting in beep frequencies which are way too high (and sound bad on
tinny laptop speakers, resulting in complaints).
[Also added hz <= 0 check by tiwai]
Signed-off-by: Paul Vojta <vojta@math.berkeley.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>