Re: [PATCH v2 114/146] ASoC: soc-topology: use modern dai_link style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux