[PATCH 3/5] ASoC: Intel: kbl-rt5660: use .exit() dailink callback to release gpiod

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Jun 22 20:26:15 CEST 2020



On 6/22/20 1:20 PM, Andy Shevchenko wrote:
> On Mon, Jun 22, 2020 at 10:42:39AM -0500, Pierre-Louis Bossart wrote:
>> The gpiod handling is inspired from the bdw-rt5677 code. Apply same
>> fix to avoid reference count issue while removing modules for
>> consistency.
> 
> ...
> 
>> -	ctx->gpio_lo_mute = devm_gpiod_get(component->dev, "lineout-mute",
>> -					   GPIOD_OUT_HIGH);
>> +	ctx->gpio_lo_mute = gpiod_get(component->dev, "lineout-mute",
>> +				      GPIOD_OUT_HIGH);
>>   	if (IS_ERR(ctx->gpio_lo_mute)) {
>>   		dev_err(component->dev, "Can't find GPIO_MUTE# gpio\n");
>>   		return PTR_ERR(ctx->gpio_lo_mute);
> 
> Is it fatal? Then IS_ERR() is not needed below. For NULL I already told.

this patch only fixes a deadlock, whether or not this is fatal or not is 
a different question. I would assert if if you can't mute your audio is 
broken.

>> +	/*
>> +	 * The .exit() can be reached without going through the .init()
>> +	 * so explicitly test if the gpiod is valid
>> +	 */
> 
> This comment should be amended after fixing the code.
> 
>> +	if (!IS_ERR_OR_NULL(ctx->gpio_lo_mute))
>> +		gpiod_put(ctx->gpio_lo_mute);
>> +}
> 


More information about the Alsa-devel mailing list