From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238AbdHXD3y (ORCPT ); Wed, 23 Aug 2017 23:29:54 -0400 Received: from regular1.263xmail.com ([211.150.99.131]:44820 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751102AbdHXD3x (ORCPT ); Wed, 23 Aug 2017 23:29:53 -0400 X-263anti-spam: KSV:0;BIG:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ADDR-CHECKED4: 1 X-ABS-CHECKED: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: broonie@kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <599E4826.1060607@rock-chips.com> Date: Thu, 24 Aug 2017 11:29:42 +0800 From: jeffy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Mark Brown CC: linux-kernel@vger.kernel.org, tiwai@suse.de, dolinux.peng@gmail.com, Jaroslav Kysela , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood Subject: Re: [PATCH] ASoC: Add a sanity check before using dai driver name References: <20170822144512.12976-1-jeffy.chen@rock-chips.com> <20170822161756.5h6smkjz6kkvl5i7@sirena.org.uk> <599CC17F.90806@rock-chips.com> <20170823110628.xergjdexrmxyqrza@sirena.org.uk> In-Reply-To: <20170823110628.xergjdexrmxyqrza@sirena.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, On 08/23/2017 07:06 PM, Mark Brown wrote: > On Wed, Aug 23, 2017 at 07:42:55AM +0800, jeffy wrote: > >> >i think the original check is allowing NULL dlc dai_name to be a match... >> >so we basically did: >> >reject when dlc dai_name is valid, but not match the dai name > So it is, but this still looks like the wrong thing - it'll match on an > empty DAI name over an explicit match on the driver name which seems > like it's the wrong way round. > sorry, i don't know much about asoc, so i just trying to keep the original conditions and add the new one on it :) the original one is: if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) continue; and i was trying to do something like: if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) && (!dai->driver->name || strcmp(dai->driver->name, dlc->dai_name))) continue; which is add an accept case for: dai driver name is valid and matches the dai name we are looking for...