Commit 20ca0c35 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Check the error from alc_codec_rename()

Should be a rare case, but...
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 636030e9
...@@ -4950,7 +4950,7 @@ static int alc269_fill_coef(struct hda_codec *codec) ...@@ -4950,7 +4950,7 @@ static int alc269_fill_coef(struct hda_codec *codec)
static int patch_alc269(struct hda_codec *codec) static int patch_alc269(struct hda_codec *codec)
{ {
struct alc_spec *spec; struct alc_spec *spec;
int err; int err = 0;
spec = kzalloc(sizeof(*spec), GFP_KERNEL); spec = kzalloc(sizeof(*spec), GFP_KERNEL);
if (spec == NULL) if (spec == NULL)
...@@ -4969,30 +4969,34 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -4969,30 +4969,34 @@ static int patch_alc269(struct hda_codec *codec)
if ((coef & 0x00f0) == 0x0010) { if ((coef & 0x00f0) == 0x0010) {
if (codec->bus->pci->subsystem_vendor == 0x1025 && if (codec->bus->pci->subsystem_vendor == 0x1025 &&
spec->cdefine.platform_type == 1) { spec->cdefine.platform_type == 1) {
alc_codec_rename(codec, "ALC271X"); err = alc_codec_rename(codec, "ALC271X");
} else if ((coef & 0xf000) == 0x2000) { } else if ((coef & 0xf000) == 0x2000) {
alc_codec_rename(codec, "ALC259"); err = alc_codec_rename(codec, "ALC259");
} else if ((coef & 0xf000) == 0x3000) { } else if ((coef & 0xf000) == 0x3000) {
alc_codec_rename(codec, "ALC258"); err = alc_codec_rename(codec, "ALC258");
} else if ((coef & 0xfff0) == 0x3010) { } else if ((coef & 0xfff0) == 0x3010) {
alc_codec_rename(codec, "ALC277"); err = alc_codec_rename(codec, "ALC277");
} else { } else {
alc_codec_rename(codec, "ALC269VB"); err = alc_codec_rename(codec, "ALC269VB");
} }
spec->codec_variant = ALC269_TYPE_ALC269VB; spec->codec_variant = ALC269_TYPE_ALC269VB;
} else if ((coef & 0x00f0) == 0x0020) { } else if ((coef & 0x00f0) == 0x0020) {
if (coef == 0xa023) if (coef == 0xa023)
alc_codec_rename(codec, "ALC259"); err = alc_codec_rename(codec, "ALC259");
else if (coef == 0x6023) else if (coef == 0x6023)
alc_codec_rename(codec, "ALC281X"); err = alc_codec_rename(codec, "ALC281X");
else if (codec->bus->pci->subsystem_vendor == 0x17aa && else if (codec->bus->pci->subsystem_vendor == 0x17aa &&
codec->bus->pci->subsystem_device == 0x21f3) codec->bus->pci->subsystem_device == 0x21f3)
alc_codec_rename(codec, "ALC3202"); err = alc_codec_rename(codec, "ALC3202");
else else
alc_codec_rename(codec, "ALC269VC"); err = alc_codec_rename(codec, "ALC269VC");
spec->codec_variant = ALC269_TYPE_ALC269VC; spec->codec_variant = ALC269_TYPE_ALC269VC;
} else } else
alc_fix_pll_init(codec, 0x20, 0x04, 15); alc_fix_pll_init(codec, 0x20, 0x04, 15);
if (err < 0) {
alc_free(codec);
return err;
}
alc269_fill_coef(codec); alc269_fill_coef(codec);
} }
...@@ -5576,7 +5580,7 @@ static const struct alc_model_fixup alc662_fixup_models[] = { ...@@ -5576,7 +5580,7 @@ static const struct alc_model_fixup alc662_fixup_models[] = {
static int patch_alc662(struct hda_codec *codec) static int patch_alc662(struct hda_codec *codec)
{ {
struct alc_spec *spec; struct alc_spec *spec;
int err; int err = 0;
int coef; int coef;
spec = kzalloc(sizeof(*spec), GFP_KERNEL); spec = kzalloc(sizeof(*spec), GFP_KERNEL);
...@@ -5596,13 +5600,17 @@ static int patch_alc662(struct hda_codec *codec) ...@@ -5596,13 +5600,17 @@ static int patch_alc662(struct hda_codec *codec)
coef = alc_read_coef_idx(codec, 0); coef = alc_read_coef_idx(codec, 0);
if (coef == 0x8020 || coef == 0x8011) if (coef == 0x8020 || coef == 0x8011)
alc_codec_rename(codec, "ALC661"); err = alc_codec_rename(codec, "ALC661");
else if (coef & (1 << 14) && else if (coef & (1 << 14) &&
codec->bus->pci->subsystem_vendor == 0x1025 && codec->bus->pci->subsystem_vendor == 0x1025 &&
spec->cdefine.platform_type == 1) spec->cdefine.platform_type == 1)
alc_codec_rename(codec, "ALC272X"); err = alc_codec_rename(codec, "ALC272X");
else if (coef == 0x4011) else if (coef == 0x4011)
alc_codec_rename(codec, "ALC656"); err = alc_codec_rename(codec, "ALC656");
if (err < 0) {
alc_free(codec);
return err;
}
alc_pick_fixup(codec, alc662_fixup_models, alc_pick_fixup(codec, alc662_fixup_models,
alc662_fixup_tbl, alc662_fixups); alc662_fixup_tbl, alc662_fixups);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment