Re: [PATCH v3 2/4] ASoC: codecs: wcd: add multi button Headset detection support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Srinivas,
cppcheck reports an issue with the use of 'hphpa_on' below

> +static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
> +{
> +	struct wcd_mbhc *mbhc = data;
> +	unsigned long timeout;
> +	int adc_threshold, output_mv, retry = 0;
> +	bool hphpa_on = false;

assigned here

> +
> +	mutex_lock(&mbhc->lock);
> +	timeout = jiffies + msecs_to_jiffies(WCD_FAKE_REMOVAL_MIN_PERIOD_MS);
> +	adc_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
> +
> +	do {
> +		retry++;
> +		/*
> +		 * read output_mv every 10ms to look for
> +		 * any change in IN2_P
> +		 */
> +		usleep_range(10000, 10100);
> +		output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
> +
> +		/* Check for fake removal */
> +		if ((output_mv <= adc_threshold) && retry > FAKE_REM_RETRY_ATTEMPTS)
> +			goto exit;
> +	} while (!time_after(jiffies, timeout));
> +
> +	/*
> +	 * ADC COMPLETE and ELEC_REM interrupts are both enabled for
> +	 * HEADPHONE, need to reject the ADC COMPLETE interrupt which
> +	 * follows ELEC_REM one when HEADPHONE is removed.
> +	 */
> +	if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADPHONE)
> +		mbhc->extn_cable_hph_rem = true;
> +
> +	wcd_mbhc_write_field(mbhc, WCD_MBHC_DETECTION_DONE, 0);
> +	wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
> +	wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);
> +	wcd_mbhc_elec_hs_report_unplug(mbhc);
> +	wcd_mbhc_write_field(mbhc, WCD_MBHC_BTN_ISRC_CTL, 0);

not used, so hphpa_on == false

> +	if (hphpa_on) {
> +		hphpa_on = false;
> +		wcd_mbhc_write_field(mbhc, WCD_MBHC_HPH_PA_EN, 3);
> +	}

And this branch is never taken.

Is there a missing hphpa = true assignment somewhere?


There's an additional issue while I am at it:

sound/soc/codecs/wcd-mbhc-v2.c:1225:17: style: Variable 'clamp_state' is
assigned a value that is never used. [unreadVariable]
 u8 clamp_state = 0;
                ^

-Pierre



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux