Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Mark Brown" <broonie@kernel.org>
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 07/11] ASoC: topology: Pass correct pointer instead of casting
Date: Wed, 25 Jan 2023 09:05:30 -0600	[thread overview]
Message-ID: <b736f2f5-eb20-78ff-0344-3263e13aefc2@linux.intel.com> (raw)
In-Reply-To: <20230125194649.3485731-8-amadeuszx.slawinski@linux.intel.com>



On 1/25/23 13:46, Amadeusz Sławiński wrote:
> Instead of passing address of structure, the containg structure is

containing?

> casted to target structure. While it works - the expected structure is

cast?

> the first field of containing one - it is bad practice, fix this by
> passing pointer to structure field.
> 
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
>  sound/soc/soc-topology.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index 766de161aa4a..c35c0c53a184 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n", be->hdr.name);
>  		goto err;
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n", mc->hdr.name);
>  		goto err;
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n", ec->hdr.name);
>  		goto err;
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n",
>  			mc->hdr.name);
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n",
>  			ec->hdr.name);
> @@ -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 */
> -	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) {
>  		dev_err(tplg->dev, "ASoC: failed to init %s\n",
>  			be->hdr.name);

  reply	other threads:[~2023-01-25 15:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 19:46 [PATCH 00/11] ASoC: topology: Fixes and cleanups Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 01/11] ASoC: topology: Properly access value coming from topology file Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 02/11] ASoC: topology: Remove unused SOC_TPLG_PASS_PINS constant Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 03/11] ASoC: topology: Fix typo in functions name Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 04/11] ASoC: topology: Fix function name Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 05/11] ASoC: topology: Rename remove_ handlers Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 06/11] ASoC: topology: Remove unnecessary forward declarations Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 07/11] ASoC: topology: Pass correct pointer instead of casting Amadeusz Sławiński
2023-01-25 15:05   ` Pierre-Louis Bossart [this message]
2023-01-25 19:46 ` [PATCH 08/11] ASoC: topology: Return an error on complete() failure Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 09/11] ASoC: Topology: Remove unnecessary check for EOF Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 10/11] ASoC: topology: Use unload() op directly Amadeusz Sławiński
2023-01-25 15:13   ` Pierre-Louis Bossart
2023-01-25 19:46 ` [PATCH 11/11] ASoC: topology: Unify kcontrol removal code Amadeusz Sławiński
2023-01-25 15:15   ` Pierre-Louis Bossart
2023-01-27 11:12     ` Amadeusz Sławiński
2023-01-27 13:38       ` Pierre-Louis Bossart
2023-01-27 15:09         ` Amadeusz Sławiński
2023-01-25 20:15 ` [PATCH 00/11] ASoC: topology: Fixes and cleanups Ranjani Sridharan
  -- strict thread matches above, loose matches on Subject: below --
2023-01-27 23:11 Amadeusz Sławiński
2023-01-27 23:11 ` [PATCH 07/11] ASoC: topology: Pass correct pointer instead of casting Amadeusz Sławiński

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b736f2f5-eb20-78ff-0344-3263e13aefc2@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox