Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1276128

Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support

From Sascha Hauer <s.hauer@pengutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Date 2015-11-24 09:00 +0100
Message-ID <qygG6-5c0-21@gated-at.bofh.it> (permalink)
References <qw6hP-nn-7@gated-at.bofh.it> <qw6hP-nn-5@gated-at.bofh.it> <qyeXE-4hD-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 2/3] thermal: Add Mediatek thermal controller support Sascha Hauer <s.hauer@pengutronix.de> - 2015-11-18 09:30 +0100
  Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support dawei chien <dawei.chien@mediatek.com> - 2015-11-24 07:10 +0100
    Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support Sascha Hauer <s.hauer@pengutronix.de> - 2015-11-24 09:00 +0100

csiph-web