Re: [PATCH V2 6/7] iio: adc: sc27xx: add support for PMIC ump9620

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux