All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
To: Mark Brown <broonie@kernel.org>
Cc: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>,
	Alviro Iskandar Setiawan <alviro.iskandar@gmail.com>,
	Codrin Ciubotariu <codrin.ciubotariu@microchip.com>,
	GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>,
	kbuild-all@lists.01.org, kernel test robot <lkp@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	llvm@lists.linux.dev, Nugraha <richiisei@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning
Date: Tue, 15 Mar 2022 00:18:48 +0000	[thread overview]
Message-ID: <20220315001848.3763534-1-alviro.iskandar@gnuweeb.org> (raw)

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 <richiisei@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/202203091430.MLY27Bif-lkp@intel.com
Fixes: 50291652af52 ("ASoC: atmel: mchp-pdmc: add PDMC driver")
Link: https://lore.gnuweeb.org/gwml/20220309065849.96165-1-alviro.iskandar@gnuweeb.org # v1
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---

  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


WARNING: multiple messages have this Message-ID (diff)
From: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
To: kbuild-all@lists.01.org
Subject: [PATCH for-5.18 v2] ASoC: atmel: mchp-pdmc: Fix `-Wpointer-bool-conversion` warning
Date: Tue, 15 Mar 2022 00:18:48 +0000	[thread overview]
Message-ID: <20220315001848.3763534-1-alviro.iskandar@gnuweeb.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

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 <richiisei@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/202203091430.MLY27Bif-lkp(a)intel.com
Fixes: 50291652af52 ("ASoC: atmel: mchp-pdmc: add PDMC driver")
Link: https://lore.gnuweeb.org/gwml/20220309065849.96165-1-alviro.iskandar(a)gnuweeb.org # v1
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---

  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

             reply	other threads:[~2022-03-15  0:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  0:18 Alviro Iskandar Setiawan [this message]
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
2022-03-15 13:40   ` Mark Brown

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=20220315001848.3763534-1-alviro.iskandar@gnuweeb.org \
    --to=alviro.iskandar@gnuweeb.org \
    --cc=alviro.iskandar@gmail.com \
    --cc=broonie@kernel.org \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=gwml@vger.gnuweeb.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=richiisei@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.