public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning
@ 2022-03-15  0:18 Alviro Iskandar Setiawan
  2022-03-15 13:40 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-15  0:18 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alviro Iskandar Setiawan, Alviro Iskandar Setiawan,
	Codrin Ciubotariu, GNU/Weeb Mailing List, kbuild-all,
	kernel test robot, Linux Kernel Mailing List, llvm, Nugraha,
	Nathan Chancellor

In function mchp_pdmc_af_put(), Intel's kernel test robot reports the
following warning:

  sound/soc/atmel/mchp-pdmc.c:186:34: warning: address of array \
  'uvalue->value.integer.value' will always evaluate to 'true' \
  [-Wpointer-bool-conversion]

This is because we are using `uvalue->value.integer.value` which its
type is `long value[128];` for conditional expression and that array
will always decay to a non-NULL pointer. Using a non-NULL pointer for
conditional expression will always evaluate to true.

Fix this by changing it to `uvalue->value.integer.value[0]` as that's
what the mchp_pdmc_af_get() function sets.

Cc: Nugraha <[email protected]>
Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]
Fixes: 50291652af52 ("ASoC: atmel: mchp-pdmc: add PDMC driver")
Link: https://lore.gnuweeb.org/gwml/[email protected] # v1
Reviewed-by: Codrin Ciubotariu <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---

  v1 -> v2:
    - Remove mailing list from the CC tags.
    - Append reviewed by tags from Nathan and Codrin.

 sound/soc/atmel/mchp-pdmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c
index c44636f6207d..7b87f75c284c 100644
--- a/sound/soc/atmel/mchp-pdmc.c
+++ b/sound/soc/atmel/mchp-pdmc.c
@@ -183,7 +183,7 @@ static int mchp_pdmc_af_put(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
 	struct mchp_pdmc *dd = snd_soc_component_get_drvdata(component);
-	bool af = uvalue->value.integer.value ? true : false;
+	bool af = uvalue->value.integer.value[0] ? true : false;
 
 	if (dd->audio_filter_en == af)
 		return 0;

base-commit: 50291652af5269813baa6024eb0e81b5f0bbb451
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning
  2022-03-15  0:18 [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning Alviro Iskandar Setiawan
@ 2022-03-15 13:40 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-03-15 13:40 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan
  Cc: Linux Kernel Mailing List, kernel test robot, Nugraha,
	Alviro Iskandar Setiawan, kbuild-all, Nathan Chancellor, llvm,
	Codrin Ciubotariu, GNU/Weeb Mailing List

On Tue, 15 Mar 2022 00:18:48 +0000, Alviro Iskandar Setiawan wrote:
> In function mchp_pdmc_af_put(), Intel's kernel test robot reports the
> following warning:
> 
>   sound/soc/atmel/mchp-pdmc.c:186:34: warning: address of array \
>   'uvalue->value.integer.value' will always evaluate to 'true' \
>   [-Wpointer-bool-conversion]
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning
      commit: a8ae15ead9c9d10671c3f76cb0749dec6e571ce7

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-15 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-15  0:18 [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning Alviro Iskandar Setiawan
2022-03-15 13:40 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox