[PATCH 3/4] ASoC: codecs: wcd934x: add mbhc support

kernel test robot lkp at intel.com
Mon May 10 23:12:18 CEST 2021


Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on lee-mfd/for-mfd-next robh/for-next v5.13-rc1 next-20210510]
[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/Srinivas-Kandagatla/ASoC-codecs-wcd934x-add-Headset-and-button-detection-support/20210510-181344
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: powerpc64-randconfig-r025-20210510 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 492173d42b32cb91d5d0d72d5ed84fcab80d059a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/0day-ci/linux/commit/97c9f617d94c14ca286bf4542d74b0968a5176c8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Srinivas-Kandagatla/ASoC-codecs-wcd934x-add-Headset-and-button-detection-support/20210510-181344
        git checkout 97c9f617d94c14ca286bf4542d74b0968a5176c8
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/wcd-mbhc-v2.c:552:8: warning: variable 'jack_type' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
                   case MBHC_PLUG_TYPE_GND_MIC_SWAP:
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/wcd-mbhc-v2.c:564:33: note: uninitialized use occurs here
                   wcd_mbhc_report_plug(mbhc, 0, jack_type);
                                                 ^~~~~~~~~
   sound/soc/codecs/wcd-mbhc-v2.c:503:2: note: variable 'jack_type' is declared here
           enum snd_jack_types jack_type;
           ^
   1 warning generated.
--
>> sound/soc/codecs/wcd934x.c:2532:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
           return ret;
                  ^~~
   sound/soc/codecs/wcd934x.c:2448:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +/ret +2532 sound/soc/codecs/wcd934x.c

  2441	
  2442	static int wcd934x_micbias_control(struct snd_soc_component *component,
  2443				    int micb_num, int req, bool is_dapm)
  2444	{
  2445		struct wcd934x_codec *wcd934x = snd_soc_component_get_drvdata(component);
  2446		int micb_index = micb_num - 1;
  2447		u16 micb_reg;
  2448		int ret;
  2449	
  2450		switch (micb_num) {
  2451		case MIC_BIAS_1:
  2452			micb_reg = WCD934X_ANA_MICB1;
  2453			break;
  2454		case MIC_BIAS_2:
  2455			micb_reg = WCD934X_ANA_MICB2;
  2456			break;
  2457		case MIC_BIAS_3:
  2458			micb_reg = WCD934X_ANA_MICB3;
  2459			break;
  2460		case MIC_BIAS_4:
  2461			micb_reg = WCD934X_ANA_MICB4;
  2462			break;
  2463		default:
  2464			dev_err(component->dev, "%s: Invalid micbias number: %d\n",
  2465				__func__, micb_num);
  2466			return -EINVAL;
  2467		};
  2468		mutex_lock(&wcd934x->micb_lock);
  2469	
  2470		switch (req) {
  2471		case MICB_PULLUP_ENABLE:
  2472			wcd934x->pullup_ref[micb_index]++;
  2473			if ((wcd934x->pullup_ref[micb_index] == 1) &&
  2474			    (wcd934x->micb_ref[micb_index] == 0))
  2475				snd_soc_component_write_field(component, micb_reg,
  2476							      WCD934X_ANA_MICB_EN_MASK,
  2477							      WCD934X_MICB_PULL_UP);
  2478			break;
  2479		case MICB_PULLUP_DISABLE:
  2480			if (wcd934x->pullup_ref[micb_index] > 0)
  2481				wcd934x->pullup_ref[micb_index]--;
  2482	
  2483			if ((wcd934x->pullup_ref[micb_index] == 0) &&
  2484			    (wcd934x->micb_ref[micb_index] == 0))
  2485				snd_soc_component_write_field(component, micb_reg,
  2486							      WCD934X_ANA_MICB_EN_MASK, 0);
  2487			break;
  2488		case MICB_ENABLE:
  2489			wcd934x->micb_ref[micb_index]++;
  2490			if (wcd934x->micb_ref[micb_index] == 1) {
  2491				snd_soc_component_write_field(component, micb_reg,
  2492							      WCD934X_ANA_MICB_EN_MASK,
  2493							      WCD934X_MICB_ENABLE);
  2494				if (micb_num  == MIC_BIAS_2)
  2495					wcd_mbhc_event_notify(wcd934x->mbhc,
  2496							      WCD_EVENT_POST_MICBIAS_2_ON);
  2497			}
  2498	
  2499			if (micb_num  == MIC_BIAS_2 && is_dapm)
  2500				wcd_mbhc_event_notify(wcd934x->mbhc,
  2501						      WCD_EVENT_POST_DAPM_MICBIAS_2_ON);
  2502			break;
  2503		case MICB_DISABLE:
  2504			if (wcd934x->micb_ref[micb_index] > 0)
  2505				wcd934x->micb_ref[micb_index]--;
  2506	
  2507			if ((wcd934x->micb_ref[micb_index] == 0) &&
  2508			    (wcd934x->pullup_ref[micb_index] > 0))
  2509				snd_soc_component_write_field(component, micb_reg,
  2510							      WCD934X_ANA_MICB_EN_MASK,
  2511							      WCD934X_MICB_PULL_UP);
  2512			else if ((wcd934x->micb_ref[micb_index] == 0) &&
  2513				 (wcd934x->pullup_ref[micb_index] == 0)) {
  2514				if (micb_num  == MIC_BIAS_2)
  2515					wcd_mbhc_event_notify(wcd934x->mbhc,
  2516							      WCD_EVENT_PRE_MICBIAS_2_OFF);
  2517	
  2518				snd_soc_component_write_field(component, micb_reg,
  2519							      WCD934X_ANA_MICB_EN_MASK, 0);
  2520				if (micb_num  == MIC_BIAS_2)
  2521					wcd_mbhc_event_notify(wcd934x->mbhc,
  2522							      WCD_EVENT_POST_MICBIAS_2_OFF);
  2523			}
  2524			if (is_dapm && micb_num  == MIC_BIAS_2)
  2525				wcd_mbhc_event_notify(wcd934x->mbhc,
  2526						      WCD_EVENT_POST_DAPM_MICBIAS_2_OFF);
  2527			break;
  2528		};
  2529	
  2530		mutex_unlock(&wcd934x->micb_lock);
  2531	
> 2532		return ret;
  2533	}
  2534	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38901 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20210511/79e0e804/attachment-0001.gz>


More information about the Alsa-devel mailing list