[PATCH 2/3] thermal: Add Mediatek thermal controller support
Sascha Hauer
s.hauer at pengutronix.de
Mon Nov 23 23:53:07 PST 2015
On Tue, Nov 24, 2015 at 02:06:09PM +0800, dawei chien wrote:
> Hi Sascha,
>
> > +static int mtk_thermal_get_calibration_data(struct device *dev, struct mtk_thermal *mt)
> > +{
> > + struct nvmem_cell *cell;
> > + u32 *buf;
> > + size_t len;
> > + int i, ret;
> > + /* Start with default values */
> > + mt->adc_ge = 512;
> > + for (i = 0; i < MT8173_NUM_SENSORS; i++)
> > + mt->vts[i] = 260;
> > + mt->degc_cali = 40;
> > + mt->o_slope = 0;
> > +
> > + cell = nvmem_cell_get(dev, "calibration-data");
> > + if (IS_ERR(cell)) {
> > + if (PTR_ERR(cell) == -EPROBE_DEFER)
> > + return PTR_ERR(cell);
> > + return 0;
> > + }
> > +
> > + buf = (u32 *)nvmem_cell_read(cell, &len);
> > +
> > + nvmem_cell_put(cell);
> > +
> > + if (IS_ERR(buf))
> > + return PTR_ERR(buf);
> > +
> > + if (len < 3 * sizeof(u32)) {
> > + dev_warn(dev, "invalid calibration data\n");
> > + ret = -EINVAL;
> > + goto out;
> > + }
>
> ret would not be assigned if the length of calibration data is correct.
> Otherwise,
gcc does a increasingly bad job when it comes to warn about
uninitialized variables :(
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the linux-arm-kernel
mailing list