Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp121526imu; Thu, 10 Jan 2019 19:41:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN7vmint5eAK8uIlXGYmQpjbyOiX1/LYq95pmloVEU+5Ko71T57K5eNVf64vG5WhcyCmZcwP X-Received: by 2002:a62:3a04:: with SMTP id h4mr12817317pfa.119.1547178082537; Thu, 10 Jan 2019 19:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547178082; cv=none; d=google.com; s=arc-20160816; b=aZkXYX7+8T+BGyidc0tSJKvINajD9ZjuiRRjHH33ntvM1KAvBZNP+EqTC9dPuQdWSj REpD1Gq0de/FwU3j9Q1oQCNsoNrTX8yylZf1uNicpaadCPwB94J4LLbuuDb43ilhxsOl WB5JAkULls/bdYGvnj+n7FXUX+df67VRbHKtfIqcOs+p5gACoFBA8LSa8II4/3K9C2Ms nyPiebOjPNhVuxcENENhItWJOx1ttk8kerdJGaQWD6sTxfmf7s5eit25/TLNV7Q9qxds QPn6Kf/PCGuKY2PLtzpZy7KaNSFjPX9smmORobiNAqRdKRHyN56Hclb/CFGEjVxiIVrW hlAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=Ji4dZg8CNTscZjfRmPBdBr/gyGTmOhjz2QOT1sUqD24=; b=bPVo/MQwWoMbM3aTgH+Z53sYeS5G7jWdKfkKtIZG+q25nRYwz7rSAjEHLBJcDL6+s2 uso5oXHozT3KLsQqHNChz2b9gEjKPet9iXBvUwpLY7AssU/rzXuZ5pF9vw9qyebLBiSF sZ1TT3D12qlWo6mkbuVdhLySxonQCBLuCQJqfpWlFSUoY63aRuzM3pYYK/tghLdRMlMx ie48/L+aEL5VD5O8d1kxxHk4yTeS/vbI3DWTlwCEvA5VxYnHIUjPaBGC4CBl05v/qzon kDgq/T2ydSbPStGZEnjb0EXx5D/dThW7WQj1w7Nu75Mf2tiiJh1honEAV1efu/HOlmVC H7iQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si16619772plv.258.2019.01.10.19.41.06; Thu, 10 Jan 2019 19:41:22 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbfAKAwP (ORCPT + 99 others); Thu, 10 Jan 2019 19:52:15 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:13673 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726745AbfAKAwP (ORCPT ); Thu, 10 Jan 2019 19:52:15 -0500 Date: 11 Jan 2019 09:52:12 +0900 X-IronPort-AV: E=Sophos;i="5.56,463,1539615600"; d="scan'208";a="4698073" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 11 Jan 2019 09:52:12 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A357C415FA50; Fri, 11 Jan 2019 09:52:12 +0900 (JST) Message-ID: <871s5kqb43.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Jon Hunter Cc: Mark Brown , Liam Girdwood , , Matthias Reichl , , Marcel Ziswiler , Takashi Iwai , , Marcel Ziswiler Subject: Re: [alsa-devel] [PATCH v1 3/3] ASoC: soc-core: fix platform name vs. of_node assignement In-Reply-To: References: <20181218174040.k7u26vnnoplllnwb@camel2.lan> <952471da-b355-6471-6c19-5120d6704f81@nvidia.com> <87lg3vuc7p.wl-kuninori.morimoto.gx@renesas.com> <865d2a3e-bf6b-1f30-1179-7e922c0d0641@nvidia.com> <87k1je38w7.wl-kuninori.morimoto.gx@renesas.com> <0660a471-3698-2059-4494-ad146518a4ed@nvidia.com> <20190109125340.GD10405@sirena.org.uk> <52f5f2cf-9260-f9c5-f73d-3c3d5debc86b@nvidia.com> <20190109141439.GE10405@sirena.org.uk> <875zuxb9uy.wl-kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jon > Actually no. Looking at snd_soc_init_multicodec() it always allocates > memory if any of the 'legacy' codec members > (codec_name/codec_of_node/codec_dai_name) are populated. However, this > looks quite fragile to me and is susceptible to leaking memory if the > user/machine driver already incorrectly allocated the memory as well as > populating these legacy codec members. Yeah, sorry I was 100% misunderstood. I thought there is a case that defered card connected to unbind_card_list, and try snd_soc_init_platform/codec again without freeing memory... very mess > My concern about all of this is it is not fool proof and hard to detect > if a machine driver is doing something bad that it should not. Yeah, agree. Best solution is removing legacy style, I think. > It is still fragile. Again the machine driver could have incorrectly set > these 'allocated_platform/codecs' members as they are exposed to the > machine driver. You have no way to determine if the machine driver is > doing the correct thing or not. The problem becomes more complex with > probe deferral. Indeed there is such case so far, but my understanding is that current driver should select "legacy style" or "modern style". If driver setup it as "legacy", but access to "modern" member, it is driver side bug, right ? Best regards --- Kuninori Morimoto