ASoC: hdac_hda: call patch_ops.free() on probe error

Add error handling for patch_ops in hdac_hda_codec_probe().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200717101950.3885187-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kai Vehmanen 2020-07-17 13:19:48 +03:00 committed by Mark Brown
parent 5856d8bd30
commit 640f835cd0
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 5 additions and 2 deletions

View File

@ -467,7 +467,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
ret = snd_hda_codec_parse_pcms(hcodec); ret = snd_hda_codec_parse_pcms(hcodec);
if (ret < 0) { if (ret < 0) {
dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret); dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);
goto error_regmap; goto error_patch;
} }
/* HDMI controls need to be created in machine drivers */ /* HDMI controls need to be created in machine drivers */
@ -476,7 +476,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
if (ret < 0) { if (ret < 0) {
dev_err(&hdev->dev, "unable to create controls %d\n", dev_err(&hdev->dev, "unable to create controls %d\n",
ret); ret);
goto error_regmap; goto error_patch;
} }
} }
@ -496,6 +496,9 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
return 0; return 0;
error_patch:
if (hcodec->patch_ops.free)
hcodec->patch_ops.free(hcodec);
error_regmap: error_regmap:
snd_hdac_regmap_exit(hdev); snd_hdac_regmap_exit(hdev);
error_pm: error_pm: