lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Feb 2014 09:02:49 +0100
From:	Jean-Francois Moine <moinejf@...e.fr>
To:	"Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com>
Cc:	Mark Brown <broonie@...nel.org>,
	"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: Re: [alsa-devel] [PATCH 2/4] ASoC: simple-card: dynamically
 allocate the DAI link array

On Mon, 24 Feb 2014 03:32:02 +0000
"Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com> wrote:
> 
> > @@ -20,7 +20,6 @@ struct simple_card_data {
> >  	unsigned int daifmt;
> >  	struct asoc_simple_dai cpu_dai;
> >  	struct asoc_simple_dai codec_dai;
> > -	struct snd_soc_dai_link snd_link;
> >  };
> > 
> >  static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
> > @@ -246,7 +245,9 @@ static int asoc_simple_card_probe(struct platform_device
> > *pdev)
> >  	struct device *dev = &pdev->dev;
> >  	int ret;
> > 
> > -	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > +	priv = devm_kzalloc(dev,
> > +			sizeof(*priv) + sizeof(*dai_link),
> 
> This is okey for me.
> 
> Well, how about splitting the *priv and *dai_link into two separated
> memory blocks? As we can get the dai-link pointer via priv->snd_card.dai_link
> in other places.
> 
> IMHO, then the code will be much more simplifier and readable.

It is just a simple optimization: less calls to memory allocation and
less code (also, less TLB reload?). I will add more comments.

-- 
Ken ar c'hentaƱ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ