Skip to content

Commit 69ddce9

Browse files
committed
Merge tag 'sound-4.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Just a few small fixes: - a fix for the recursive work cancellation in a specific HD-audio operation mode - a fix for potentially uninitialized memory access via rawmidi - the register bit access fixes for ASoC HD-audio" * tag 'sound-4.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: Fix several mismatch for register mask and value ALSA: rawmidi: Initialize allocated buffers ALSA: hda - Fix cancel_work_sync() stall from jackpoll work
2 parents a49a9dc + f7c50fa commit 69ddce9

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

sound/core/rawmidi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
129129
runtime->avail = 0;
130130
else
131131
runtime->avail = runtime->buffer_size;
132-
runtime->buffer = kvmalloc(runtime->buffer_size, GFP_KERNEL);
132+
runtime->buffer = kvzalloc(runtime->buffer_size, GFP_KERNEL);
133133
if (!runtime->buffer) {
134134
kfree(runtime);
135135
return -ENOMEM;
@@ -655,7 +655,7 @@ static int resize_runtime_buffer(struct snd_rawmidi_runtime *runtime,
655655
if (params->avail_min < 1 || params->avail_min > params->buffer_size)
656656
return -EINVAL;
657657
if (params->buffer_size != runtime->buffer_size) {
658-
newbuf = kvmalloc(params->buffer_size, GFP_KERNEL);
658+
newbuf = kvzalloc(params->buffer_size, GFP_KERNEL);
659659
if (!newbuf)
660660
return -ENOMEM;
661661
spin_lock_irq(&runtime->lock);

sound/hda/ext/hdac_ext_stream.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple);
146146
*/
147147
void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream)
148148
{
149-
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_RUN);
149+
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
150+
AZX_PPLCCTL_RUN, AZX_PPLCCTL_RUN);
150151
}
151152
EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_start);
152153

@@ -171,7 +172,8 @@ void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream)
171172

172173
snd_hdac_ext_link_stream_clear(stream);
173174

174-
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_STRST);
175+
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
176+
AZX_PPLCCTL_STRST, AZX_PPLCCTL_STRST);
175177
udelay(3);
176178
timeout = 50;
177179
do {
@@ -242,7 +244,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_set_stream_id);
242244
void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
243245
int stream)
244246
{
245-
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, 0, (1 << stream));
247+
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0);
246248
}
247249
EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id);
248250

@@ -415,7 +417,6 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus,
415417
bool enable, int index)
416418
{
417419
u32 mask = 0;
418-
u32 register_mask = 0;
419420

420421
if (!bus->spbcap) {
421422
dev_err(bus->dev, "Address of SPB capability is NULL\n");
@@ -424,12 +425,8 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus,
424425

425426
mask |= (1 << index);
426427

427-
register_mask = readl(bus->spbcap + AZX_REG_SPB_SPBFCCTL);
428-
429-
mask |= register_mask;
430-
431428
if (enable)
432-
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, 0, mask);
429+
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, mask);
433430
else
434431
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0);
435432
}
@@ -503,7 +500,6 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
503500
bool enable, int index)
504501
{
505502
u32 mask = 0;
506-
u32 register_mask = 0;
507503

508504
if (!bus->drsmcap) {
509505
dev_err(bus->dev, "Address of DRSM capability is NULL\n");
@@ -512,12 +508,8 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
512508

513509
mask |= (1 << index);
514510

515-
register_mask = readl(bus->drsmcap + AZX_REG_SPB_SPBFCCTL);
516-
517-
mask |= register_mask;
518-
519511
if (enable)
520-
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, 0, mask);
512+
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, mask);
521513
else
522514
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, 0);
523515
}

sound/pci/hda/hda_codec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3935,7 +3935,8 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus)
39353935

39363936
list_for_each_codec(codec, bus) {
39373937
/* FIXME: maybe a better way needed for forced reset */
3938-
cancel_delayed_work_sync(&codec->jackpoll_work);
3938+
if (current_work() != &codec->jackpoll_work.work)
3939+
cancel_delayed_work_sync(&codec->jackpoll_work);
39393940
#ifdef CONFIG_PM
39403941
if (hda_codec_is_power_on(codec)) {
39413942
hda_call_codec_suspend(codec);

0 commit comments

Comments
 (0)