Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751165AbdHXDrB (ORCPT ); Wed, 23 Aug 2017 23:47:01 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:35057 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdHXDrA (ORCPT ); Wed, 23 Aug 2017 23:47:00 -0400 MIME-Version: 1.0 In-Reply-To: <20170824033411.5788-1-jeffy.chen@rock-chips.com> References: <20170824033411.5788-1-jeffy.chen@rock-chips.com> From: Donglin Peng Date: Thu, 24 Aug 2017 11:46:39 +0800 Message-ID: Subject: Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, Mark Brown , tiwai@suse.de, Jaroslav Kysela , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 611 Lines: 13 On Thu, Aug 24, 2017 at 11:34 AM, Jeffy Chen wrote: > list_for_each_entry(dai, &component->dai_list, list) { > if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) > - && strcmp(dai->driver->name, dlc->dai_name)) > + && (!dai->driver->name > + || !strcmp(dai->driver->name, dlc->dai_name)) > continue; If the dai->driver->name is match with the dlc->dai_name, does it need to continue? > > return dai;