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

From: Li.Xiubo@xxxxxxxxxxxxx
Date: Thu Jan 23 2014 - 01:35:44 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/