From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: Re: [PATCH v2 114/146] ASoC: soc-topology: use modern dai_link style Date: 07 Jun 2019 09:27:08 +0900 Message-ID: <87d0jqe4if.wl-kuninori.morimoto.gx@renesas.com> References: <87h893mkvi.wl-kuninori.morimoto.gx@renesas.com> <87v9xjfjgo.wl-kuninori.morimoto.gx@renesas.com> <20190606151747.343ddd4c@xxx> <10285830-e164-13b6-05c7-966806f45c18@linux.intel.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 66B96F896CE for ; Fri, 7 Jun 2019 02:27:10 +0200 (CEST) In-Reply-To: <10285830-e164-13b6-05c7-966806f45c18@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Pierre-Louis Bossart Cc: Linux-ALSA , Mark Brown , Amadeusz =?ISO-8859-2?Q?S=B3awi=F1ski?= List-Id: alsa-devel@alsa-project.org Hi Amadeusz Thank you for your feedback > >> + /* link + cpu + codec */ > >> + link = kzalloc(sizeof(*link) + (2 * sizeof(*dlc)), > >> GFP_KERNEL); if (link == NULL) > >> return -ENOMEM; > >> + dlc = (struct snd_soc_dai_link_component *)(link + 1); > >> + > >> + link->cpus = &dlc[0]; > >> + link->codecs = &dlc[1]; > > > > While I understand what is going on here, I find this bit ugly. > > It's not so bad and it avoid multiple tests and tags that are just as > ugly IMHO. Yeah, it is using a little bit tricky method. > > Can it perhaps be changed to something like: > > > > link = kzalloc(sizeof(*link), GFP_KERNEL); > > if (link == NULL) > > return -ENOMEM; > > link->cpus = kzalloc(sizeof(*dlc), GFP_KERNEL); > > if (link->cpus == NULL) { > > ret = -ENOMEM; > > goto err; > > } > > link->codecs = kzalloc(sizeof(*dlc), GFP_KERNEL); > > if (link->cpus == NULL) { > > ret = -ENOMEM; > > goto err; > > } >>From "logic" point of view, I think this patch has no bug, but from "readable code" point of view, I have no objection to exchange like above. I'm not familiar with this driver, so, can you handle it by incremental patch if you want? Thank you for your help !! Best regards --- Kuninori Morimoto