Commit 952bd937 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: topology: factor kfree(se) in error handling

No need to repeat the same thing multiple times when it can be done in
one location.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200707203749.113883-5-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 129fc2ba
...@@ -1055,7 +1055,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1055,7 +1055,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
dev_err(tplg->dev, dev_err(tplg->dev,
"ASoC: could not create values for %s\n", "ASoC: could not create values for %s\n",
ec->hdr.name); ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
/* fall through */ /* fall through */
...@@ -1067,7 +1066,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1067,7 +1066,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
dev_err(tplg->dev, dev_err(tplg->dev,
"ASoC: could not create texts for %s\n", "ASoC: could not create texts for %s\n",
ec->hdr.name); ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
break; break;
...@@ -1076,7 +1074,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1076,7 +1074,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
dev_err(tplg->dev, dev_err(tplg->dev,
"ASoC: invalid enum control type %d for %s\n", "ASoC: invalid enum control type %d for %s\n",
ec->hdr.ops.info, ec->hdr.name); ec->hdr.ops.info, ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
...@@ -1084,7 +1081,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1084,7 +1081,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
err = soc_tplg_kcontrol_bind_io(&ec->hdr, &kc, tplg); err = soc_tplg_kcontrol_bind_io(&ec->hdr, &kc, tplg);
if (err) { if (err) {
soc_control_err(tplg, &ec->hdr, ec->hdr.name); soc_control_err(tplg, &ec->hdr, ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
...@@ -1094,7 +1090,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1094,7 +1090,6 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
if (err < 0) { if (err < 0) {
dev_err(tplg->dev, "ASoC: failed to init %s\n", dev_err(tplg->dev, "ASoC: failed to init %s\n",
ec->hdr.name); ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
...@@ -1104,13 +1099,15 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -1104,13 +1099,15 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
if (err < 0) { if (err < 0) {
dev_err(tplg->dev, "ASoC: could not add kcontrol %s\n", dev_err(tplg->dev, "ASoC: could not add kcontrol %s\n",
ec->hdr.name); ec->hdr.name);
kfree(se);
goto err_denum; goto err_denum;
} }
list_add(&se->dobj.list, &tplg->comp->dobj_list); list_add(&se->dobj.list, &tplg->comp->dobj_list);
} }
return 0;
err_denum: err_denum:
kfree(se);
return err; return err;
} }
......
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