[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220402180905.4e85bd5c@jic23-huawei>
Date: Sat, 2 Apr 2022 18:09:32 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Cixi Geng <gengcixi@...il.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Orson Zhai <orsonzhai@...il.com>,
"baolin.wang7@...il.com" <baolin.wang7@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>, lgirdwood@...il.com,
Mark Brown <broonie@...nel.org>,
"朱玉明 (Yuming Zhu/11457) "
<yuming.zhu1@...soc.com>, linux-iio@...r.kernel.org,
Devicetree List <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [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
Powered by blists - more mailing lists