Commit d1f83d6e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: call missing snd_ctl_remove()

Current Renesas R-Car sound driver is using snd_ctl_xxx()
functions, but it didn't call snd_ctl free_one() / snd_ctl_remove().
This patch call these functions.
Reported-by: default avatarNguyen Viet Dung <nv-dung@jinso.co.jp>
Reported-by: default avatarBui Duc Phuc <bd-phuc@jinso.co.jp>
Reported-by: default avatarCao Minh Hiep <cm-hiep@jinso.co.jp>
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8048b91f
...@@ -1046,14 +1046,23 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod, ...@@ -1046,14 +1046,23 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
return -ENOMEM; return -ENOMEM;
ret = snd_ctl_add(card, kctrl); ret = snd_ctl_add(card, kctrl);
if (ret < 0) if (ret < 0) {
snd_ctl_free_one(kctrl);
return ret; return ret;
}
cfg->update = update; cfg->update = update;
cfg->card = card;
cfg->kctrl = kctrl;
return 0; return 0;
} }
void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg)
{
snd_ctl_remove(cfg->card, cfg->kctrl);
}
int rsnd_kctrl_new_m(struct rsnd_mod *mod, int rsnd_kctrl_new_m(struct rsnd_mod *mod,
struct snd_soc_pcm_runtime *rtd, struct snd_soc_pcm_runtime *rtd,
const unsigned char *name, const unsigned char *name,
......
...@@ -127,6 +127,20 @@ static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod, ...@@ -127,6 +127,20 @@ static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
return 0; return 0;
} }
static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
struct rsnd_priv *priv)
{
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
rsnd_kctrl_remove(dvc->volume);
rsnd_kctrl_remove(dvc->mute);
rsnd_kctrl_remove(dvc->ren);
rsnd_kctrl_remove(dvc->rup);
rsnd_kctrl_remove(dvc->rdown);
return 0;
}
static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
...@@ -258,6 +272,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -258,6 +272,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
static struct rsnd_mod_ops rsnd_dvc_ops = { static struct rsnd_mod_ops rsnd_dvc_ops = {
.name = DVC_NAME, .name = DVC_NAME,
.probe = rsnd_dvc_probe_gen2, .probe = rsnd_dvc_probe_gen2,
.remove = rsnd_dvc_remove_gen2,
.init = rsnd_dvc_init, .init = rsnd_dvc_init,
.quit = rsnd_dvc_quit, .quit = rsnd_dvc_quit,
.start = rsnd_dvc_start, .start = rsnd_dvc_start,
......
...@@ -436,6 +436,8 @@ struct rsnd_kctrl_cfg { ...@@ -436,6 +436,8 @@ struct rsnd_kctrl_cfg {
u32 *val; u32 *val;
const char * const *texts; const char * const *texts;
void (*update)(struct rsnd_mod *mod); void (*update)(struct rsnd_mod *mod);
struct snd_card *card;
struct snd_kcontrol *kctrl;
}; };
#define RSND_DVC_CHANNELS 2 #define RSND_DVC_CHANNELS 2
...@@ -449,6 +451,9 @@ struct rsnd_kctrl_cfg_s { ...@@ -449,6 +451,9 @@ struct rsnd_kctrl_cfg_s {
u32 val; u32 val;
}; };
void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg);
#define rsnd_kctrl_remove(_cfg) _rsnd_kctrl_remove(&((_cfg).cfg))
int rsnd_kctrl_new_m(struct rsnd_mod *mod, int rsnd_kctrl_new_m(struct rsnd_mod *mod,
struct snd_soc_pcm_runtime *rtd, struct snd_soc_pcm_runtime *rtd,
const unsigned char *name, const unsigned char *name,
......
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