Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbbKXHxR (ORCPT ); Tue, 24 Nov 2015 02:53:17 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:55176 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751616AbbKXHxQ (ORCPT ); Tue, 24 Nov 2015 02:53:16 -0500 Date: Tue, 24 Nov 2015 08:53:07 +0100 From: Sascha Hauer To: dawei chien Cc: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel@pengutronix.de, Matthias Brugger , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support Message-ID: <20151124075307.GZ11966@pengutronix.de> References: <1447835066-10482-1-git-send-email-s.hauer@pengutronix.de> <1447835066-10482-3-git-send-email-s.hauer@pengutronix.de> <1448345169.2421.20.camel@mtksdaap41> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448345169.2421.20.camel@mtksdaap41> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:50:19 up 37 days, 16:29, 72 users, load average: 0.14, 0.13, 0.08 User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1648 Lines: 54 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/