From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754091AbbI3GP1 (ORCPT ); Wed, 30 Sep 2015 02:15:27 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:46390 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753528AbbI3GPZ (ORCPT ); Wed, 30 Sep 2015 02:15:25 -0400 Date: Wed, 30 Sep 2015 08:14:59 +0200 From: Sascha Hauer To: Vladimir Zapolskiy Cc: Eduardo Valentin , linux-pm@vger.kernel.org, Zhang Rui , linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Matthias Brugger , devicetree@vger.kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Subject: Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support Message-ID: <20150930061459.GW7858@pengutronix.de> References: <1443015463-23639-1-git-send-email-s.hauer@pengutronix.de> <1443015463-23639-3-git-send-email-s.hauer@pengutronix.de> <5602EFF0.8040207@mentor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5602EFF0.8040207@mentor.com> 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:14:07 up 10 days, 19:43, 62 users, load average: 0.14, 0.12, 0.14 User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi Vladimir, On Wed, Sep 23, 2015 at 09:31:12PM +0300, Vladimir Zapolskiy wrote: > Hi Sascha, > > in case of OF_DYNAMIC enabled of_parse_phandle() requires of_node_put(), > which is fine to place right here. > > > + if (auxadc_phys_base == OF_BAD_ADDR) { > > + dev_err(&pdev->dev, "Can't get auxadc phys address\n"); > > + return -EINVAL; > > + } > > + > > [snip] > > > + > > + /* > > + * These calibration values should finally be provided by the > > + * firmware or fuses. For now use default values. > > + */ > > + mt->calib_slope = -123; > > + mt->calib_offset = 465124; > > + > > + for (i = 0; i < MT8173_NUM_ZONES; i++) > > + mtk_thermal_init_bank(mt, i, apmixed_phys_base, auxadc_phys_base); > > + > > + platform_set_drvdata(pdev, mt); > > + > > + for (i = 0; i < MT8173_NUM_ZONES; i++) { > > + struct mtk_thermal_bank *bank = &mt->banks[i]; > > + > > + bank->tzd = thermal_zone_of_sensor_register(&pdev->dev, i, bank, > > + &mtk_thermal_ops); > > I would propose to add return value checks here, otherwise there might > be an oops in mtk_thermal_remove(), if something goes wrong. Thanks for the input. I'll fix that in the next round. 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 |