diff mbox series

ASoC: fsl_asrc_m2m: force cast for snd_pcm_format_t type

Message ID 20241218024358.3022635-1-shengjiu.wang@nxp.com (mailing list archive)
State Accepted
Commit cf126261d5d3b8767fd9c838ffe7213144d05147
Headers show
Series ASoC: fsl_asrc_m2m: force cast for snd_pcm_format_t type | expand

Commit Message

Shengjiu Wang Dec. 18, 2024, 2:43 a.m. UTC
Fix sparse warnings:

fsl_asrc_m2m.c:360:45: sparse: warning: incorrect type in argument 1 (different base types)
fsl_asrc_m2m.c:360:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
fsl_asrc_m2m.c:360:45: sparse:    got unsigned int [usertype] format
fsl_asrc_m2m.c:361:41: sparse: warning: incorrect type in assignment (different base types)
fsl_asrc_m2m.c:361:41: sparse:    expected restricted snd_pcm_format_t
fsl_asrc_m2m.c:361:41: sparse:    got unsigned int [usertype] format
fsl_asrc_m2m.c:365:45: sparse: warning: incorrect type in argument 1 (different base types)
fsl_asrc_m2m.c:365:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
fsl_asrc_m2m.c:365:45: sparse:    got unsigned int [usertype] pcm_format
fsl_asrc_m2m.c:366:42: sparse: warning: incorrect type in assignment (different base types)
fsl_asrc_m2m.c:366:42: sparse:    expected restricted snd_pcm_format_t
fsl_asrc_m2m.c:366:42: sparse:    got unsigned int [usertype] pcm_format
fsl_asrc_m2m.c:595:54: sparse: warning: incorrect type in assignment (different base types)
fsl_asrc_m2m.c:595:54: sparse:    expected unsigned int [usertype] formats
fsl_asrc_m2m.c:595:54: sparse:    got restricted snd_pcm_format_t [assigned] [usertype] k

Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202412180043.PAA4t4sQ-lkp@intel.com/
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_asrc_m2m.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Daniel Baluta Dec. 18, 2024, 2:28 p.m. UTC | #1
On Wed, Dec 18, 2024 at 4:46 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> Fix sparse warnings:
>
> fsl_asrc_m2m.c:360:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:360:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:360:45: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:361:41: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:361:41: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:361:41: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:365:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:365:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:365:45: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:366:42: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:366:42: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:366:42: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:595:54: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:595:54: sparse:    expected unsigned int [usertype] formats
> fsl_asrc_m2m.c:595:54: sparse:    got restricted snd_pcm_format_t [assigned] [usertype] k
>
> Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202412180043.PAA4t4sQ-lkp@intel.com/
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  sound/soc/fsl/fsl_asrc_m2m.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
> index f266a3f5fd48..4906843e2a8f 100644
> --- a/sound/soc/fsl/fsl_asrc_m2m.c
> +++ b/sound/soc/fsl/fsl_asrc_m2m.c
> @@ -357,13 +357,13 @@ static int fsl_asrc_m2m_comp_set_params(struct snd_compr_stream *stream,
>         if (ret)
>                 return -EINVAL;
>
> -       if (pcm_format_to_bits(params->codec.format) & cap.fmt_in)
> -               pair->sample_format[IN] = params->codec.format;
> +       if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.format) & cap.fmt_in)
> +               pair->sample_format[IN] = (__force snd_pcm_format_t)params->codec.format;
>         else
>                 return -EINVAL;
>
> -       if (pcm_format_to_bits(params->codec.pcm_format) & cap.fmt_out)
> -               pair->sample_format[OUT] = params->codec.pcm_format;
> +       if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.pcm_format) & cap.fmt_out)
> +               pair->sample_format[OUT] = (__force snd_pcm_format_t)params->codec.pcm_format;
>         else
>                 return -EINVAL;
>
> @@ -592,7 +592,7 @@ static int fsl_asrc_m2m_fill_codec_caps(struct fsl_asrc *asrc,
>                                cap.rate_in,
>                                cap.rate_in_count * sizeof(__u32));
>                         codec->descriptor[j].num_sample_rates = cap.rate_in_count;
> -                       codec->descriptor[j].formats = k;
> +                       codec->descriptor[j].formats = (__force __u32)k;
>                         codec->descriptor[j].pcm_formats = cap.fmt_out;
>                         codec->descriptor[j].src.out_sample_rate_min = cap.rate_out[0];
>                         codec->descriptor[j].src.out_sample_rate_max =
> --
> 2.34.1
>
>
Daniel Baluta Dec. 18, 2024, 2:29 p.m. UTC | #2
On Wed, Dec 18, 2024 at 4:46 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> Fix sparse warnings:
>
> fsl_asrc_m2m.c:360:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:360:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:360:45: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:361:41: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:361:41: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:361:41: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:365:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:365:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:365:45: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:366:42: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:366:42: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:366:42: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:595:54: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:595:54: sparse:    expected unsigned int [usertype] formats
> fsl_asrc_m2m.c:595:54: sparse:    got restricted snd_pcm_format_t [assigned] [usertype] k
>
> Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202412180043.PAA4t4sQ-lkp@intel.com/
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Mark Brown Dec. 18, 2024, 4:16 p.m. UTC | #3
On Wed, 18 Dec 2024 10:43:58 +0800, Shengjiu Wang wrote:
> Fix sparse warnings:
> 
> fsl_asrc_m2m.c:360:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:360:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:360:45: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:361:41: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:361:41: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:361:41: sparse:    got unsigned int [usertype] format
> fsl_asrc_m2m.c:365:45: sparse: warning: incorrect type in argument 1 (different base types)
> fsl_asrc_m2m.c:365:45: sparse:    expected restricted snd_pcm_format_t [usertype] pcm_forma
> fsl_asrc_m2m.c:365:45: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:366:42: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:366:42: sparse:    expected restricted snd_pcm_format_t
> fsl_asrc_m2m.c:366:42: sparse:    got unsigned int [usertype] pcm_format
> fsl_asrc_m2m.c:595:54: sparse: warning: incorrect type in assignment (different base types)
> fsl_asrc_m2m.c:595:54: sparse:    expected unsigned int [usertype] formats
> fsl_asrc_m2m.c:595:54: sparse:    got restricted snd_pcm_format_t [assigned] [usertype] k
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: fsl_asrc_m2m: force cast for snd_pcm_format_t type
      commit: cf126261d5d3b8767fd9c838ffe7213144d05147

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index f266a3f5fd48..4906843e2a8f 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -357,13 +357,13 @@  static int fsl_asrc_m2m_comp_set_params(struct snd_compr_stream *stream,
 	if (ret)
 		return -EINVAL;
 
-	if (pcm_format_to_bits(params->codec.format) & cap.fmt_in)
-		pair->sample_format[IN] = params->codec.format;
+	if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.format) & cap.fmt_in)
+		pair->sample_format[IN] = (__force snd_pcm_format_t)params->codec.format;
 	else
 		return -EINVAL;
 
-	if (pcm_format_to_bits(params->codec.pcm_format) & cap.fmt_out)
-		pair->sample_format[OUT] = params->codec.pcm_format;
+	if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.pcm_format) & cap.fmt_out)
+		pair->sample_format[OUT] = (__force snd_pcm_format_t)params->codec.pcm_format;
 	else
 		return -EINVAL;
 
@@ -592,7 +592,7 @@  static int fsl_asrc_m2m_fill_codec_caps(struct fsl_asrc *asrc,
 			       cap.rate_in,
 			       cap.rate_in_count * sizeof(__u32));
 			codec->descriptor[j].num_sample_rates = cap.rate_in_count;
-			codec->descriptor[j].formats = k;
+			codec->descriptor[j].formats = (__force __u32)k;
 			codec->descriptor[j].pcm_formats = cap.fmt_out;
 			codec->descriptor[j].src.out_sample_rate_min = cap.rate_out[0];
 			codec->descriptor[j].src.out_sample_rate_max =