Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2996949imm; Fri, 19 Oct 2018 03:24:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV637OkEBWvUEOeVM1V5jnNFYzMqHVqOeh57KwiB9MrBTtYAUGkFrrb3AIEwP0BvFYzz/BMnA X-Received: by 2002:a63:8dc4:: with SMTP id z187-v6mr1044143pgd.126.1539944695491; Fri, 19 Oct 2018 03:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539944695; cv=none; d=google.com; s=arc-20160816; b=BQmiGKRQvrHDsErWpAJElXbfT185aWw2X/t0pc7BhUhJ8qlz7jWqqMYvzPHOAw52AD 5Mb+5JVvcp6sdkQb45Pg5JHFnUreDZfBEVK4YvH+2/4POU4GNU6V6h4TLFNbxQmoDdOJ WQdXFpC9Sqh83WwPqV3Bumlab7i9m8Bb3squkiFc7yZEdu0qBXDpiATQlKiS46aIV/OG +ET4nU4ZkcE30GQAQvB4+HT+OHgaRIKvyLM6gQTEWG5saZFOOkvRTBv7HGrl0HrpXqv+ gqVqMueEWjfpEWzrYyxmZgPqpA1V1tpd+LQ+C8gjRQ265yDqo9BClFx5IKPbs2hQ2GrB QHmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=bc0Q5U9+ahOH8rR9CBaPc/8DMVKaF9MvH5u9wZnq1YQ=; b=uXt4IuRrKvuF/v83Kmr63FGliJXAJhvp56waXcHfwFvmvR3jrvc3oZ496V+XPUaCbf /W/nus2/dfzlxGW32FFiSlkNzYcZ4vxc2k5qXUIpnj+6BZxtygq/osB9mFpTZJjumceD NbafKwpTdHIHxgjs2z+WxGySHUGdCUcdEG4dJbYUJmiBu3C9XgNlUwK2/lXDBTrEIwHf GEnP+cDPm0PUZcllSR6y0I4EvQGb9TM2RCQMXhiHAZ6q2NJChypU/WZfLW4QiBNuX8b4 5sthy4ouaO6lJmUlSP7gNFoEhZ8Le73j/42S/8rC3/2pHK9cdadEpa79M+RvN/K0CEM6 nOnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=MuU8mMyt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i37-v6si22330454pgi.15.2018.10.19.03.24.39; Fri, 19 Oct 2018 03:24:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=MuU8mMyt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727336AbeJSS2U (ORCPT + 99 others); Fri, 19 Oct 2018 14:28:20 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:8179 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbeJSS2U (ORCPT ); Fri, 19 Oct 2018 14:28:20 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 19 Oct 2018 03:22:47 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 19 Oct 2018 03:22:52 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 19 Oct 2018 03:22:52 -0700 Received: from [10.26.11.35] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 19 Oct 2018 10:22:49 +0000 Subject: Re: [PATCH v1 3/3] ASoC: soc-core: fix platform name vs. of_node assignement To: Marcel Ziswiler , , , CC: Mark Brown , Kuninori Morimoto , Marcel Ziswiler , Jaroslav Kysela , Takashi Iwai , Liam Girdwood References: <20181018111829.27056-1-marcel@ziswiler.com> <20181018111829.27056-4-marcel@ziswiler.com> From: Jon Hunter Message-ID: Date: Fri, 19 Oct 2018 11:22:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181018111829.27056-4-marcel@ziswiler.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1539944568; bh=bc0Q5U9+ahOH8rR9CBaPc/8DMVKaF9MvH5u9wZnq1YQ=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=MuU8mMytmHfnbLmJvmD/clZ1WjYwtBpNHXVVNCMwlrvD4WflwDwdzBLqi8syGisfD 9gaSYYaeYCyDRbAfDav9F2oae/NIiRQdnHyd/OkhTyk7wvzO88upTZ9C+jSJb1AKm2 woZnPXlIoPQci7Arx1jNblkeXJ8ILB0vghp2Xq7qc1vBEJu8tj4yfUtAHik8ezwWMV atUL+5Du7fpjQL5rsE68tVjykwIzs9BDmlxTgPYeLN+ELntMP/6LNO1v3UKP4CDMd6 dk4qBeTm1JoYzBgyhGp98oxGC/+6VPWb1zP4hSkRcKIUyG4ufATY5CqdtSF7jxXOMd 6XPsrepnu+uXw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/10/2018 12:18, Marcel Ziswiler wrote: > From: Marcel Ziswiler > > This fixes the following error as seen post commit daecf46ee0e5 > ("ASoC: soc-core: use snd_soc_dai_link_component for platform") on > Apalis TK1 after initial probe deferral: > > tegra-snd-sgtl5000 sound: ASoC: Both platform name/of_node are set for > sgtl5000 > tegra-snd-sgtl5000 sound: ASoC: failed to init link sgtl5000 > tegra-snd-sgtl5000 sound: snd_soc_register_card failed (-22) > tegra-snd-sgtl5000: probe of sound failed with error -22 > > Signed-off-by: Marcel Ziswiler > > --- > > Changes in v1: > - Split from the Tegra series as suggested by Mark. > - Fix issue in soc-core rather than working around it in tegra_sgtl5000. > > sound/soc/soc-core.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c > index 6ddcf12bc030..b97624005976 100644 > --- a/sound/soc/soc-core.c > +++ b/sound/soc/soc-core.c > @@ -2733,7 +2733,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card) > int snd_soc_register_card(struct snd_soc_card *card) > { > int i, ret; > - struct snd_soc_dai_link *link; > + struct snd_soc_dai_link *link = NULL; > > if (!card->name || !card->dev) > return -EINVAL; > @@ -2744,7 +2744,7 @@ int snd_soc_register_card(struct snd_soc_card *card) > if (ret) { > dev_err(card->dev, "ASoC: failed to init link %s\n", > link->name); > - return ret; > + goto err; > } > } > > @@ -2763,7 +2763,17 @@ int snd_soc_register_card(struct snd_soc_card *card) > mutex_init(&card->mutex); > mutex_init(&card->dapm_mutex); > > - return snd_soc_bind_card(card); > + ret = snd_soc_bind_card(card); > + if (ret) > + goto err; > + > + return 0; > + > +err: > + if (link && link->platform) > + link->platform = NULL; Looking at snd_soc_init_platform(), it seems that the platform pointer can be allocated by the machine driver and so if it is not allocated by the core, then I don't think we should clear it here. Seems we need a way to determine if this was allocated by the core. Furthermore, it seems that it is possible that there is more than one link that might be to be cleared. Cheers Jon -- nvpublic