lkml.org 
[lkml]   [2022]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 6/7] iio: adc: sc27xx: add support for PMIC ump9620

> Hi Jonathan:
> It used origin_calib_data in memcpy,and the length of data
> may less than sizeof(u32). we expect the other bits keeps 0;
> So we initialise 0 in here.
Ah. I'd missed that. Thanks for the explanation.

> >
> > > + size_t len = 0;
> > > +
> > > + if (!data)
> > > + return -EINVAL;
> > > +
> > > + cell = nvmem_cell_get(data->dev, cell_name);
> > > + if (IS_ERR(cell))
> > > + return PTR_ERR(cell);
> > > +
> > > + buf = nvmem_cell_read(cell, &len);
> > > + if (IS_ERR(buf)) {
> > > + nvmem_cell_put(cell);
> > > + return PTR_ERR(buf);
> > > + }
> > > +
> > > + memcpy(&origin_calib_data, buf, min(len, sizeof(u32)));
> > > +
> > > + kfree(buf);
> > > + nvmem_cell_put(cell);
> > > + return origin_calib_data;
> > > +}

Jonathan

\
 
 \ /
  Last update: 2022-04-02 19:03    [W:0.324 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site