Re: [EXTERNAL] Re: [PATCH v1] ASoc: tas2781: Add Calibration Kcontrols and tas2563 digtial gain for Chromebook

From: Andy Shevchenko
Date: Fri Aug 09 2024 - 10:36:53 EST


On Mon, Jun 24, 2024 at 11:42:11AM +0000, Ding, Shenghao wrote:
> > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Sent: Wednesday, May 22, 2024 8:02 PM
> > To: Ding, Shenghao <shenghao-ding@xxxxxx>
> > On Wed, May 22, 2024 at 07: 29: 41PM +0800, Shenghao Ding wrote: >


(some comments were not answered, are you agree on all of the points?)

...

> > > + cali_data->data = devm_kzalloc(tas_priv->dev, tas_priv->ndev *
> > > + (cali_data->reg_array_sz * 4 + 1), GFP_KERNEL);
> >
> > No way. First of all, we have kcalloc(), second, there is an overflow.h that has
> > necessary macros to calculate sizes for memory allocations.
> Memory allocated with devm_kzalloc is automatically freed on driver detach while kcalloc can’t

Yes, we have devm variant for kcalloc(), why can it be not utilised?

> > > + if (!cali_data->data)
> > > + return -ENOMEM;

--
With Best Regards,
Andy Shevchenko