Skip to content

Commit c37279b

Browse files
bwhackstiwai
authored andcommitted
ALSA: fm801: Gracefully handle failure of tuner auto-detect
Commit 9676001 ("ALSA: fm801: add error handling if auto-detect fails") seems to break systems that were previously working without a tuner. As a bonus, this should fix init and cleanup for the case where the tuner is explicitly disabled. Reported-and-tested-by: Hor Jiun Shyong <jiunshyong@gmail.com> References: http://bugs.debian.org/641946 Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Cc: stable@kernel.org [v3.0+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 2ba34e4 commit c37279b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎sound/pci/fm801.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
6868
module_param_array(tea575x_tuner, int, NULL, 0444);
6969
MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (0 = auto, 1 = SF256-PCS, 2=SF256-PCP, 3=SF64-PCR, 8=disable, +16=tuner-only).");
7070

71+
#define TUNER_DISABLED (1<<3)
7172
#define TUNER_ONLY (1<<4)
7273
#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF)
7374

@@ -1150,7 +1151,8 @@ static int snd_fm801_free(struct fm801 *chip)
11501151

11511152
__end_hw:
11521153
#ifdef CONFIG_SND_FM801_TEA575X_BOOL
1153-
snd_tea575x_exit(&chip->tea);
1154+
if (!(chip->tea575x_tuner & TUNER_DISABLED))
1155+
snd_tea575x_exit(&chip->tea);
11541156
#endif
11551157
if (chip->irq >= 0)
11561158
free_irq(chip->irq, chip);
@@ -1250,10 +1252,15 @@ static int __devinit snd_fm801_create(struct snd_card *card,
12501252
}
12511253
if (tea575x_tuner == 4) {
12521254
snd_printk(KERN_ERR "TEA575x radio not found\n");
1253-
return -ENODEV;
1255+
chip->tea575x_tuner = TUNER_DISABLED;
12541256
}
12551257
}
1256-
strlcpy(chip->tea.card, snd_fm801_tea575x_gpios[(tea575x_tuner & TUNER_TYPE_MASK) - 1].name, sizeof(chip->tea.card));
1258+
if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
1259+
strlcpy(chip->tea.card,
1260+
snd_fm801_tea575x_gpios[(tea575x_tuner &
1261+
TUNER_TYPE_MASK) - 1].name,
1262+
sizeof(chip->tea.card));
1263+
}
12571264
#endif
12581265

12591266
*rchip = chip;

0 commit comments

Comments
 (0)