All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Seven Lee <wtli@nuvoton.com>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, scott6986@gmail.com, lkp@intel.com,
	Seven Lee <wtli@nuvoton.com>,
	KCHSU0@nuvoton.com, lgirdwood@gmail.com, YHCHuang@nuvoton.com,
	CTLIN0@nuvoton.com, dardar923@gmail.com, kbuild-all@lists.01.org,
	supercraig0719@gmail.com
Subject: Re: [PATCH] ASoC: nau8821: Add driver for Nuvoton codec NAU88L21
Date: Wed, 25 Aug 2021 10:03:12 +0300	[thread overview]
Message-ID: <202108250013.326roo2Z-lkp@intel.com> (raw)
In-Reply-To: <20210824041647.1732378-1-wtli@nuvoton.com>

Hi Seven,

url:    https://github.com/0day-ci/linux/commits/Seven-Lee/ASoC-nau8821-Add-driver-for-Nuvoton-codec-NAU88L21/20210824-121846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: openrisc-randconfig-m031-20210824 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/codecs/nau8821.c:456 dmic_clock_control() error: uninitialized symbol 'speed_selection'.

vim +/speed_selection +456 sound/soc/codecs/nau8821.c

429cd8c43255317 Seven Lee 2021-08-24  419  static const struct snd_kcontrol_new nau8821_adc_ch0_dmic =
429cd8c43255317 Seven Lee 2021-08-24  420  	SOC_DAPM_SINGLE("Switch", NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  421  		NAU8821_DMIC_EN_SFT, 1, 0);
429cd8c43255317 Seven Lee 2021-08-24  422  
429cd8c43255317 Seven Lee 2021-08-24  423  static int dmic_clock_control(struct snd_soc_dapm_widget *w,
429cd8c43255317 Seven Lee 2021-08-24  424  		struct snd_kcontrol *k, int  event)
429cd8c43255317 Seven Lee 2021-08-24  425  {
429cd8c43255317 Seven Lee 2021-08-24  426  	struct snd_soc_component *component =
429cd8c43255317 Seven Lee 2021-08-24  427  		snd_soc_dapm_to_component(w->dapm);
429cd8c43255317 Seven Lee 2021-08-24  428  	struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
429cd8c43255317 Seven Lee 2021-08-24  429  	int i, speed_selection, clk_adc_src, clk_adc;
429cd8c43255317 Seven Lee 2021-08-24  430  	unsigned int clk_divider_r03;
429cd8c43255317 Seven Lee 2021-08-24  431  
429cd8c43255317 Seven Lee 2021-08-24  432  	/* The DMIC clock is gotten from adc clock divided by
429cd8c43255317 Seven Lee 2021-08-24  433  	 * CLK_DMIC_SRC (1, 2, 4, 8). The clock has to be equal or
429cd8c43255317 Seven Lee 2021-08-24  434  	 * less than nau8821->dmic_clk_threshold.
429cd8c43255317 Seven Lee 2021-08-24  435  	 */
429cd8c43255317 Seven Lee 2021-08-24  436  	regmap_read(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
429cd8c43255317 Seven Lee 2021-08-24  437  		&clk_divider_r03);
429cd8c43255317 Seven Lee 2021-08-24  438  	clk_adc_src = (clk_divider_r03 & NAU8821_CLK_ADC_SRC_MASK)
429cd8c43255317 Seven Lee 2021-08-24  439  		>> NAU8821_CLK_ADC_SRC_SFT;
429cd8c43255317 Seven Lee 2021-08-24  440  	clk_adc = (nau8821->fs * 256) >> clk_adc_src;
429cd8c43255317 Seven Lee 2021-08-24  441  
429cd8c43255317 Seven Lee 2021-08-24  442  	for (i = 0 ; i < 4 ; i++) {
429cd8c43255317 Seven Lee 2021-08-24  443  		if ((clk_adc >> dmic_speed_sel[i].param) <=
429cd8c43255317 Seven Lee 2021-08-24  444  			nau8821->dmic_clk_threshold) {
429cd8c43255317 Seven Lee 2021-08-24  445  			speed_selection = dmic_speed_sel[i].val;
429cd8c43255317 Seven Lee 2021-08-24  446  			break;
429cd8c43255317 Seven Lee 2021-08-24  447  		}
429cd8c43255317 Seven Lee 2021-08-24  448  	}

speed_selection is not initialized if it exits the loop with i == 4.

429cd8c43255317 Seven Lee 2021-08-24  449  
429cd8c43255317 Seven Lee 2021-08-24  450  	dev_dbg(nau8821->dev,
429cd8c43255317 Seven Lee 2021-08-24  451  		"clk_adc=%d, dmic_clk_threshold = %d, param=%d, val = %d\n",
429cd8c43255317 Seven Lee 2021-08-24  452  		clk_adc, nau8821->dmic_clk_threshold,
429cd8c43255317 Seven Lee 2021-08-24  453  		dmic_speed_sel[i].param, dmic_speed_sel[i].val);
429cd8c43255317 Seven Lee 2021-08-24  454  	regmap_update_bits(nau8821->regmap, NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  455  		NAU8821_DMIC_SRC_MASK,
429cd8c43255317 Seven Lee 2021-08-24 @456  		(speed_selection << NAU8821_DMIC_SRC_SFT));
429cd8c43255317 Seven Lee 2021-08-24  457  
429cd8c43255317 Seven Lee 2021-08-24  458  	return 0;
429cd8c43255317 Seven Lee 2021-08-24  459  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] ASoC: nau8821: Add driver for Nuvoton codec NAU88L21
Date: Wed, 25 Aug 2021 00:54:24 +0800	[thread overview]
Message-ID: <202108250013.326roo2Z-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210824041647.1732378-1-wtli@nuvoton.com>
References: <20210824041647.1732378-1-wtli@nuvoton.com>
TO: Seven Lee <wtli@nuvoton.com>
TO: broonie(a)kernel.org
CC: alsa-devel(a)alsa-project.org
CC: scott6986(a)gmail.com
CC: Seven Lee <wtli@nuvoton.com>
CC: KCHSU0(a)nuvoton.com
CC: lgirdwood(a)gmail.com
CC: YHCHuang(a)nuvoton.com
CC: CTLIN0(a)nuvoton.com
CC: dardar923(a)gmail.com
CC: supercraig0719(a)gmail.com

Hi Seven,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v5.14-rc7 next-20210824]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Seven-Lee/ASoC-nau8821-Add-driver-for-Nuvoton-codec-NAU88L21/20210824-121846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: openrisc-randconfig-m031-20210824 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/codecs/nau8821.c:456 dmic_clock_control() error: uninitialized symbol 'speed_selection'.

vim +/speed_selection +456 sound/soc/codecs/nau8821.c

429cd8c43255317 Seven Lee 2021-08-24  418  
429cd8c43255317 Seven Lee 2021-08-24  419  static const struct snd_kcontrol_new nau8821_adc_ch0_dmic =
429cd8c43255317 Seven Lee 2021-08-24  420  	SOC_DAPM_SINGLE("Switch", NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  421  		NAU8821_DMIC_EN_SFT, 1, 0);
429cd8c43255317 Seven Lee 2021-08-24  422  
429cd8c43255317 Seven Lee 2021-08-24  423  static int dmic_clock_control(struct snd_soc_dapm_widget *w,
429cd8c43255317 Seven Lee 2021-08-24  424  		struct snd_kcontrol *k, int  event)
429cd8c43255317 Seven Lee 2021-08-24  425  {
429cd8c43255317 Seven Lee 2021-08-24  426  	struct snd_soc_component *component =
429cd8c43255317 Seven Lee 2021-08-24  427  		snd_soc_dapm_to_component(w->dapm);
429cd8c43255317 Seven Lee 2021-08-24  428  	struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
429cd8c43255317 Seven Lee 2021-08-24  429  	int i, speed_selection, clk_adc_src, clk_adc;
429cd8c43255317 Seven Lee 2021-08-24  430  	unsigned int clk_divider_r03;
429cd8c43255317 Seven Lee 2021-08-24  431  
429cd8c43255317 Seven Lee 2021-08-24  432  	/* The DMIC clock is gotten from adc clock divided by
429cd8c43255317 Seven Lee 2021-08-24  433  	 * CLK_DMIC_SRC (1, 2, 4, 8). The clock has to be equal or
429cd8c43255317 Seven Lee 2021-08-24  434  	 * less than nau8821->dmic_clk_threshold.
429cd8c43255317 Seven Lee 2021-08-24  435  	 */
429cd8c43255317 Seven Lee 2021-08-24  436  	regmap_read(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
429cd8c43255317 Seven Lee 2021-08-24  437  		&clk_divider_r03);
429cd8c43255317 Seven Lee 2021-08-24  438  	clk_adc_src = (clk_divider_r03 & NAU8821_CLK_ADC_SRC_MASK)
429cd8c43255317 Seven Lee 2021-08-24  439  		>> NAU8821_CLK_ADC_SRC_SFT;
429cd8c43255317 Seven Lee 2021-08-24  440  	clk_adc = (nau8821->fs * 256) >> clk_adc_src;
429cd8c43255317 Seven Lee 2021-08-24  441  
429cd8c43255317 Seven Lee 2021-08-24  442  	for (i = 0 ; i < 4 ; i++) {
429cd8c43255317 Seven Lee 2021-08-24  443  		if ((clk_adc >> dmic_speed_sel[i].param) <=
429cd8c43255317 Seven Lee 2021-08-24  444  			nau8821->dmic_clk_threshold) {
429cd8c43255317 Seven Lee 2021-08-24  445  			speed_selection = dmic_speed_sel[i].val;
429cd8c43255317 Seven Lee 2021-08-24  446  			break;
429cd8c43255317 Seven Lee 2021-08-24  447  		}
429cd8c43255317 Seven Lee 2021-08-24  448  	}
429cd8c43255317 Seven Lee 2021-08-24  449  
429cd8c43255317 Seven Lee 2021-08-24  450  	dev_dbg(nau8821->dev,
429cd8c43255317 Seven Lee 2021-08-24  451  		"clk_adc=%d, dmic_clk_threshold = %d, param=%d, val = %d\n",
429cd8c43255317 Seven Lee 2021-08-24  452  		clk_adc, nau8821->dmic_clk_threshold,
429cd8c43255317 Seven Lee 2021-08-24  453  		dmic_speed_sel[i].param, dmic_speed_sel[i].val);
429cd8c43255317 Seven Lee 2021-08-24  454  	regmap_update_bits(nau8821->regmap, NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  455  		NAU8821_DMIC_SRC_MASK,
429cd8c43255317 Seven Lee 2021-08-24 @456  		(speed_selection << NAU8821_DMIC_SRC_SFT));
429cd8c43255317 Seven Lee 2021-08-24  457  
429cd8c43255317 Seven Lee 2021-08-24  458  	return 0;
429cd8c43255317 Seven Lee 2021-08-24  459  }
429cd8c43255317 Seven Lee 2021-08-24  460  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35926 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] ASoC: nau8821: Add driver for Nuvoton codec NAU88L21
Date: Wed, 25 Aug 2021 10:03:12 +0300	[thread overview]
Message-ID: <202108250013.326roo2Z-lkp@intel.com> (raw)
In-Reply-To: <20210824041647.1732378-1-wtli@nuvoton.com>

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

Hi Seven,

url:    https://github.com/0day-ci/linux/commits/Seven-Lee/ASoC-nau8821-Add-driver-for-Nuvoton-codec-NAU88L21/20210824-121846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: openrisc-randconfig-m031-20210824 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/codecs/nau8821.c:456 dmic_clock_control() error: uninitialized symbol 'speed_selection'.

vim +/speed_selection +456 sound/soc/codecs/nau8821.c

429cd8c43255317 Seven Lee 2021-08-24  419  static const struct snd_kcontrol_new nau8821_adc_ch0_dmic =
429cd8c43255317 Seven Lee 2021-08-24  420  	SOC_DAPM_SINGLE("Switch", NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  421  		NAU8821_DMIC_EN_SFT, 1, 0);
429cd8c43255317 Seven Lee 2021-08-24  422  
429cd8c43255317 Seven Lee 2021-08-24  423  static int dmic_clock_control(struct snd_soc_dapm_widget *w,
429cd8c43255317 Seven Lee 2021-08-24  424  		struct snd_kcontrol *k, int  event)
429cd8c43255317 Seven Lee 2021-08-24  425  {
429cd8c43255317 Seven Lee 2021-08-24  426  	struct snd_soc_component *component =
429cd8c43255317 Seven Lee 2021-08-24  427  		snd_soc_dapm_to_component(w->dapm);
429cd8c43255317 Seven Lee 2021-08-24  428  	struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
429cd8c43255317 Seven Lee 2021-08-24  429  	int i, speed_selection, clk_adc_src, clk_adc;
429cd8c43255317 Seven Lee 2021-08-24  430  	unsigned int clk_divider_r03;
429cd8c43255317 Seven Lee 2021-08-24  431  
429cd8c43255317 Seven Lee 2021-08-24  432  	/* The DMIC clock is gotten from adc clock divided by
429cd8c43255317 Seven Lee 2021-08-24  433  	 * CLK_DMIC_SRC (1, 2, 4, 8). The clock has to be equal or
429cd8c43255317 Seven Lee 2021-08-24  434  	 * less than nau8821->dmic_clk_threshold.
429cd8c43255317 Seven Lee 2021-08-24  435  	 */
429cd8c43255317 Seven Lee 2021-08-24  436  	regmap_read(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
429cd8c43255317 Seven Lee 2021-08-24  437  		&clk_divider_r03);
429cd8c43255317 Seven Lee 2021-08-24  438  	clk_adc_src = (clk_divider_r03 & NAU8821_CLK_ADC_SRC_MASK)
429cd8c43255317 Seven Lee 2021-08-24  439  		>> NAU8821_CLK_ADC_SRC_SFT;
429cd8c43255317 Seven Lee 2021-08-24  440  	clk_adc = (nau8821->fs * 256) >> clk_adc_src;
429cd8c43255317 Seven Lee 2021-08-24  441  
429cd8c43255317 Seven Lee 2021-08-24  442  	for (i = 0 ; i < 4 ; i++) {
429cd8c43255317 Seven Lee 2021-08-24  443  		if ((clk_adc >> dmic_speed_sel[i].param) <=
429cd8c43255317 Seven Lee 2021-08-24  444  			nau8821->dmic_clk_threshold) {
429cd8c43255317 Seven Lee 2021-08-24  445  			speed_selection = dmic_speed_sel[i].val;
429cd8c43255317 Seven Lee 2021-08-24  446  			break;
429cd8c43255317 Seven Lee 2021-08-24  447  		}
429cd8c43255317 Seven Lee 2021-08-24  448  	}

speed_selection is not initialized if it exits the loop with i == 4.

429cd8c43255317 Seven Lee 2021-08-24  449  
429cd8c43255317 Seven Lee 2021-08-24  450  	dev_dbg(nau8821->dev,
429cd8c43255317 Seven Lee 2021-08-24  451  		"clk_adc=%d, dmic_clk_threshold = %d, param=%d, val = %d\n",
429cd8c43255317 Seven Lee 2021-08-24  452  		clk_adc, nau8821->dmic_clk_threshold,
429cd8c43255317 Seven Lee 2021-08-24  453  		dmic_speed_sel[i].param, dmic_speed_sel[i].val);
429cd8c43255317 Seven Lee 2021-08-24  454  	regmap_update_bits(nau8821->regmap, NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  455  		NAU8821_DMIC_SRC_MASK,
429cd8c43255317 Seven Lee 2021-08-24 @456  		(speed_selection << NAU8821_DMIC_SRC_SFT));
429cd8c43255317 Seven Lee 2021-08-24  457  
429cd8c43255317 Seven Lee 2021-08-24  458  	return 0;
429cd8c43255317 Seven Lee 2021-08-24  459  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

       reply	other threads:[~2021-08-25  7:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 16:54 kernel test robot [this message]
2021-08-25  7:03 ` [PATCH] ASoC: nau8821: Add driver for Nuvoton codec NAU88L21 Dan Carpenter
2021-08-25  7:03 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-08-24  4:16 Seven Lee
2021-08-24  8:39 ` kernel test robot
2021-08-24  8:39   ` kernel test robot
2021-08-24 16:02 ` Pierre-Louis Bossart
2021-08-24 17:32   ` Mark Brown
2021-09-15  3:50     ` Seven Lee
2021-09-15 11:45       ` Mark Brown
2021-09-15  3:34   ` Seven Lee
2021-08-26 17:16 ` Mark Brown
2021-09-16  6:13   ` Seven Lee

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=202108250013.326roo2Z-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=CTLIN0@nuvoton.com \
    --cc=KCHSU0@nuvoton.com \
    --cc=YHCHuang@nuvoton.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dardar923@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lgirdwood@gmail.com \
    --cc=lkp@intel.com \
    --cc=scott6986@gmail.com \
    --cc=supercraig0719@gmail.com \
    --cc=wtli@nuvoton.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.