Skip to content

Commit cf30f46

Browse files
committed
Merge branch 'for-linus' into for-next
Back-merged for refactoring beep stuff.
2 parents 0959f22 + a86b1a2 commit cf30f46

21 files changed

Lines changed: 166 additions & 60 deletions

‎Documentation/sound/alsa/ALSA-Configuration.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
912912
models depending on the codec chip. The list of available models
913913
is found in HD-Audio-Models.txt
914914

915-
The model name "genric" is treated as a special case. When this
915+
The model name "generic" is treated as a special case. When this
916916
model is given, the driver uses the generic codec parser without
917917
"codec-patch". It's sometimes good for testing and debugging.
918918

‎Documentation/sound/alsa/seq_oss.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ <H4>
285285
<H4>
286286
7.2.4 Close Callback</H4>
287287
The <TT>close</TT> callback is called when this device is closed by the
288-
applicaion. If any private data was allocated in open callback, it must
288+
application. If any private data was allocated in open callback, it must
289289
be released in the close callback. The deletion of ALSA port should be
290290
done here, too. This callback must not be NULL.
291291
<H4>

‎sound/core/seq/oss/seq_oss_event.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,12 @@ local_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev
285285
static int
286286
note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
287287
{
288-
struct seq_oss_synthinfo *info = &dp->synths[dev];
288+
struct seq_oss_synthinfo *info;
289+
290+
if (!snd_seq_oss_synth_is_valid(dp, dev))
291+
return -ENXIO;
292+
293+
info = &dp->synths[dev];
289294
switch (info->arg.event_passing) {
290295
case SNDRV_SEQ_OSS_PROCESS_EVENTS:
291296
if (! info->ch || ch < 0 || ch >= info->nr_voices) {
@@ -340,7 +345,12 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st
340345
static int
341346
note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
342347
{
343-
struct seq_oss_synthinfo *info = &dp->synths[dev];
348+
struct seq_oss_synthinfo *info;
349+
350+
if (!snd_seq_oss_synth_is_valid(dp, dev))
351+
return -ENXIO;
352+
353+
info = &dp->synths[dev];
344354
switch (info->arg.event_passing) {
345355
case SNDRV_SEQ_OSS_PROCESS_EVENTS:
346356
if (! info->ch || ch < 0 || ch >= info->nr_voices) {

‎sound/core/seq/seq_timer.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)
290290
tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;
291291
err = snd_timer_open(&t, str, &tid, q->queue);
292292
}
293-
if (err < 0) {
294-
snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
295-
return err;
296-
}
293+
}
294+
if (err < 0) {
295+
snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
296+
return err;
297297
}
298298
t->callback = snd_seq_timer_interrupt;
299299
t->callback_data = q;

‎sound/core/vmaster.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol *kcontrol,
213213
}
214214
if (!changed)
215215
return 0;
216-
return slave_put_val(slave, ucontrol);
216+
err = slave_put_val(slave, ucontrol);
217+
if (err < 0)
218+
return err;
219+
return 1;
217220
}
218221

219222
static int slave_tlv_cmd(struct snd_kcontrol *kcontrol,

‎sound/oss/sequencer.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
545545
case MIDI_PGM_CHANGE:
546546
if (seq_mode == SEQ_2)
547547
{
548+
if (chn > 15)
549+
break;
550+
548551
synth_devs[dev]->chn_info[chn].pgm_num = p1;
549552
if ((int) dev >= num_synths)
550553
synth_devs[dev]->set_instr(dev, chn, p1);
@@ -596,6 +599,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
596599
case MIDI_PITCH_BEND:
597600
if (seq_mode == SEQ_2)
598601
{
602+
if (chn > 15)
603+
break;
604+
599605
synth_devs[dev]->chn_info[chn].bender_value = w14;
600606

601607
if ((int) dev < num_synths)

‎sound/pci/asihpi/asihpi.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2549,14 +2549,15 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
25492549

25502550
static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
25512551
{
2552-
struct snd_card *card = asihpi->card;
2552+
struct snd_card *card;
25532553
unsigned int idx = 0;
25542554
unsigned int subindex = 0;
25552555
int err;
25562556
struct hpi_control hpi_ctl, prev_ctl;
25572557

25582558
if (snd_BUG_ON(!asihpi))
25592559
return -EINVAL;
2560+
card = asihpi->card;
25602561
strcpy(card->mixername, "Asihpi Mixer");
25612562

25622563
err =

‎sound/pci/hda/hda_codec.c‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid)
494494

495495
int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid)
496496
{
497-
return get_num_conns(codec, nid) & AC_CLIST_LENGTH;
497+
return snd_hda_get_raw_connections(codec, nid, NULL, 0);
498498
}
499499

500500
/**
@@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
517517
hda_nid_t prev_nid;
518518
int null_count = 0;
519519

520-
if (snd_BUG_ON(!conn_list || max_conns <= 0))
521-
return -EINVAL;
522-
523520
parm = get_num_conns(codec, nid);
524521
if (!parm)
525522
return 0;
@@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
545542
AC_VERB_GET_CONNECT_LIST, 0);
546543
if (parm == -1 && codec->bus->rirb_error)
547544
return -EIO;
548-
conn_list[0] = parm & mask;
545+
if (conn_list)
546+
conn_list[0] = parm & mask;
549547
return 1;
550548
}
551549

@@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
580578
continue;
581579
}
582580
for (n = prev_nid + 1; n <= val; n++) {
581+
if (conn_list) {
582+
if (conns >= max_conns)
583+
return -ENOSPC;
584+
conn_list[conns] = n;
585+
}
586+
conns++;
587+
}
588+
} else {
589+
if (conn_list) {
583590
if (conns >= max_conns)
584591
return -ENOSPC;
585-
conn_list[conns++] = n;
592+
conn_list[conns] = val;
586593
}
587-
} else {
588-
if (conns >= max_conns)
589-
return -ENOSPC;
590-
conn_list[conns++] = val;
594+
conns++;
591595
}
592596
prev_nid = val;
593597
}
@@ -3331,6 +3335,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
33313335
return -EBUSY;
33323336
}
33333337
spdif = snd_array_new(&codec->spdif_out);
3338+
if (!spdif)
3339+
return -ENOMEM;
33343340
for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
33353341
kctl = snd_ctl_new1(dig_mix, codec);
33363342
if (!kctl)
@@ -3428,11 +3434,16 @@ static struct snd_kcontrol_new spdif_share_sw = {
34283434
int snd_hda_create_spdif_share_sw(struct hda_codec *codec,
34293435
struct hda_multi_out *mout)
34303436
{
3437+
struct snd_kcontrol *kctl;
3438+
34313439
if (!mout->dig_out_nid)
34323440
return 0;
3441+
3442+
kctl = snd_ctl_new1(&spdif_share_sw, mout);
3443+
if (!kctl)
3444+
return -ENOMEM;
34333445
/* ATTENTION: here mout is passed as private_data, instead of codec */
3434-
return snd_hda_ctl_add(codec, mout->dig_out_nid,
3435-
snd_ctl_new1(&spdif_share_sw, mout));
3446+
return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl);
34363447
}
34373448
EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);
34383449

‎sound/pci/hda/patch_ca0132.c‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,11 @@ static int dspxfr_one_seg(struct hda_codec *codec,
22982298
hda_frame_size_words = ((sample_rate_div == 0) ? 0 :
22992299
(num_chans * sample_rate_mul / sample_rate_div));
23002300

2301+
if (hda_frame_size_words == 0) {
2302+
snd_printdd(KERN_ERR "frmsz zero\n");
2303+
return -EINVAL;
2304+
}
2305+
23012306
buffer_size_words = min(buffer_size_words,
23022307
(unsigned int)(UC_RANGE(chip_addx, 1) ?
23032308
65536 : 32768));
@@ -2308,8 +2313,7 @@ static int dspxfr_one_seg(struct hda_codec *codec,
23082313
chip_addx, hda_frame_size_words, num_chans,
23092314
sample_rate_mul, sample_rate_div, buffer_size_words);
23102315

2311-
if ((buffer_addx == NULL) || (hda_frame_size_words == 0) ||
2312-
(buffer_size_words < hda_frame_size_words)) {
2316+
if (buffer_size_words < hda_frame_size_words) {
23132317
snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n");
23142318
return -EINVAL;
23152319
}
@@ -3235,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val)
32353239
struct ca0132_spec *spec = codec->spec;
32363240
unsigned int tmp;
32373241

3238-
if (!dspload_is_loaded(codec))
3242+
if (spec->dsp_state != DSP_DOWNLOADED)
32393243
return 0;
32403244

32413245
/* if CrystalVoice if off, vipsource should be 0 */
@@ -4263,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec)
42634267
*/
42644268
static void ca0132_setup_defaults(struct hda_codec *codec)
42654269
{
4270+
struct ca0132_spec *spec = codec->spec;
42664271
unsigned int tmp;
42674272
int num_fx;
42684273
int idx, i;
42694274

4270-
if (!dspload_is_loaded(codec))
4275+
if (spec->dsp_state != DSP_DOWNLOADED)
42714276
return;
42724277

42734278
/* out, in effects + voicefx */
@@ -4347,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
43474352
return false;
43484353

43494354
dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
4350-
dspload_image(codec, dsp_os_image, 0, 0, true, 0);
4355+
if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) {
4356+
pr_err("ca0132 dspload_image failed.\n");
4357+
goto exit_download;
4358+
}
4359+
43514360
dsp_loaded = dspload_wait_loaded(codec);
43524361

4362+
exit_download:
43534363
release_firmware(fw_entry);
43544364

4355-
43564365
return dsp_loaded;
43574366
}
43584367

@@ -4363,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec)
43634372
#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP
43644373
return; /* NOP */
43654374
#endif
4366-
spec->dsp_state = DSP_DOWNLOAD_INIT;
43674375

4368-
if (spec->dsp_state == DSP_DOWNLOAD_INIT) {
4369-
chipio_enable_clocks(codec);
4370-
spec->dsp_state = DSP_DOWNLOADING;
4371-
if (!ca0132_download_dsp_images(codec))
4372-
spec->dsp_state = DSP_DOWNLOAD_FAILED;
4373-
else
4374-
spec->dsp_state = DSP_DOWNLOADED;
4375-
}
4376+
chipio_enable_clocks(codec);
4377+
spec->dsp_state = DSP_DOWNLOADING;
4378+
if (!ca0132_download_dsp_images(codec))
4379+
spec->dsp_state = DSP_DOWNLOAD_FAILED;
4380+
else
4381+
spec->dsp_state = DSP_DOWNLOADED;
43764382

43774383
if (spec->dsp_state == DSP_DOWNLOADED)
43784384
ca0132_set_dsp_msr(codec, true);

‎sound/pci/hda/patch_cirrus.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec)
506506
if (!spec)
507507
return -ENOMEM;
508508

509+
spec->gen.automute_hook = cs_automute;
510+
509511
snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
510512
cs420x_fixups);
511513
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec)
893895
if (!spec)
894896
return -ENOMEM;
895897

898+
spec->gen.automute_hook = cs_automute;
899+
896900
snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl,
897901
cs421x_fixups);
898902
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);

0 commit comments

Comments
 (0)