[alsa-devel] [PATCH 6/8] ASoC: simple-card: add tdm slot supports

Li.Xiubo at freescale.com Li.Xiubo at freescale.com
Thu Jan 23 07:35:35 CET 2014


Hi David,

Firstly thanks for your comment.

> > +asoc_simple_card_of_parse_tdm_slot(struct device_node *np,
> > +				   struct device *dev,
> > +				   struct asoc_simple_dai *dai,
> > +				   const char *propname)
> > +{
> > +	struct asoc_simple_tdm_slot *tdm;
> > +	u32 out_value[4];
> > +	int ret;
> > +
> > +	if (!of_property_read_bool(np, propname))
> > +		return 0;
> > +
> > +	tdm = devm_kzalloc(dev, sizeof(*tdm), GFP_KERNEL);
> > +	if (!tdm)
> > +		return -ENOMEM;
> > +
> > +	ret = of_property_read_u32_array(np, propname, out_value, 4);
> > +	if (ret)
> > +		return ret;
> 
> Looks like a memory leak?
>

Using devm_ and this will be called by _probe().

Please see the "Documentation/driver-model/devres.txt" for detail about
devres.

 
> > +
> > +	tdm->tx_mask = out_value[0];
> > +	tdm->rx_mask = out_value[1];
> > +	tdm->slots = out_value[2];
> > +	tdm->slot_width = out_value[3];
> > +
> > +	dai->tdm = tdm;
> > +
> > +	return 0;
> > +}
> > +

Thanks,

Best Regards,
Xiubo



More information about the Alsa-devel mailing list