Commit 9e2ee000 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Pass correct pointer instead of casting

Instead of passing address of structure, the containing structure is
cast to target structure. While it works - the expected structure is the
first field of containing one - it is bad practice, fix this by passing
pointer to structure field.
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230127231111.937721-8-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 70a7cd09
...@@ -721,7 +721,7 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, size_t size) ...@@ -721,7 +721,7 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, size_t size)
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
ret = soc_tplg_control_load(tplg, &kc, (struct snd_soc_tplg_ctl_hdr *)be); ret = soc_tplg_control_load(tplg, &kc, &be->hdr);
if (ret < 0) { if (ret < 0) {
dev_err(tplg->dev, "ASoC: failed to init %s\n", be->hdr.name); dev_err(tplg->dev, "ASoC: failed to init %s\n", be->hdr.name);
goto err; goto err;
...@@ -805,7 +805,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, size_t size) ...@@ -805,7 +805,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, size_t size)
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
ret = soc_tplg_control_load(tplg, &kc, (struct snd_soc_tplg_ctl_hdr *)mc); ret = soc_tplg_control_load(tplg, &kc, &mc->hdr);
if (ret < 0) { if (ret < 0) {
dev_err(tplg->dev, "ASoC: failed to init %s\n", mc->hdr.name); dev_err(tplg->dev, "ASoC: failed to init %s\n", mc->hdr.name);
goto err; goto err;
...@@ -973,7 +973,7 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, size_t size) ...@@ -973,7 +973,7 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, size_t size)
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
ret = soc_tplg_control_load(tplg, &kc, (struct snd_soc_tplg_ctl_hdr *)ec); ret = soc_tplg_control_load(tplg, &kc, &ec->hdr);
if (ret < 0) { if (ret < 0) {
dev_err(tplg->dev, "ASoC: failed to init %s\n", ec->hdr.name); dev_err(tplg->dev, "ASoC: failed to init %s\n", ec->hdr.name);
goto err; goto err;
...@@ -1189,7 +1189,7 @@ static int soc_tplg_dapm_widget_dmixer_create(struct soc_tplg *tplg, struct snd_ ...@@ -1189,7 +1189,7 @@ static int soc_tplg_dapm_widget_dmixer_create(struct soc_tplg *tplg, struct snd_
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
err = soc_tplg_control_load(tplg, kc, (struct snd_soc_tplg_ctl_hdr *)mc); err = soc_tplg_control_load(tplg, kc, &mc->hdr);
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",
mc->hdr.name); mc->hdr.name);
...@@ -1273,7 +1273,7 @@ static int soc_tplg_dapm_widget_denum_create(struct soc_tplg *tplg, struct snd_k ...@@ -1273,7 +1273,7 @@ static int soc_tplg_dapm_widget_denum_create(struct soc_tplg *tplg, struct snd_k
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
err = soc_tplg_control_load(tplg, kc, (struct snd_soc_tplg_ctl_hdr *)ec); err = soc_tplg_control_load(tplg, kc, &ec->hdr);
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);
...@@ -1325,7 +1325,7 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_ ...@@ -1325,7 +1325,7 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
err = soc_tplg_control_load(tplg, kc, (struct snd_soc_tplg_ctl_hdr *)be); err = soc_tplg_control_load(tplg, kc, &be->hdr);
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",
be->hdr.name); be->hdr.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