[alsa-devel] [PATCH] ASoC: acpi: fix: continue searching when machine is ignored

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Nov 16 00:01:12 CET 2018


Hi Keyon,

>> The machine_quirk may return NULL which means the acpi entries should be
>> skipped and search for next matched entry is needed, here add return
>> check here and continue for NULL case.
>
> Nice catch, this was missed in the other patchset since the ACPI ID to 
> ignore was the last in the table...
>
> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>

I was wondering if this patch was merged, but actually it's good Mark 
wasn't copied on this one: the code doesn't quite work as intended and 
shouldn't be merged as is.

Chintan and I see an oops and reboot on KBL Chromebooks, when the quirk 
returns NULL, the mach variable becomes NULL and cannot be modified with 
pointer arithmetic (which doesn't show with the diff format).

It's very likely btw that anyone trying a recent kernel on these devices 
would not see the audio driver probe at all, so we do want to try other 
entries - but of course without this nasty side effect. I will submit a 
v2 when I've sorted out other problems on Chrome.

Thanks

-Pierre

>
>>
>> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
>> ---
>>   sound/soc/soc-acpi.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
>> index b8e72b52db30..faf8941363e4 100644
>> --- a/sound/soc/soc-acpi.c
>> +++ b/sound/soc/soc-acpi.c
>> @@ -15,7 +15,10 @@ snd_soc_acpi_find_machine(struct snd_soc_acpi_mach 
>> *machines)
>>           if (acpi_dev_present(mach->id, NULL, -1)) {
>>               if (mach->machine_quirk)
>>                   mach = mach->machine_quirk(mach);
>> -            return mach;
>> +
>> +            /* return matched machine, continue otherwise */
>> +            if (mach)
>> +                return mach;
>>           }
>>       }
>>       return NULL;
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


More information about the Alsa-devel mailing list