Received: by 10.192.165.156 with SMTP id m28csp586692imm; Fri, 13 Apr 2018 04:34:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48p7tm6gjSxJRKgYZnhOirGHIkAFjvxmMAqcQD1gJ3GOka8W94w2rpoMreGsCPaykOESgA3 X-Received: by 2002:a17:902:887:: with SMTP id 7-v6mr4958455pll.319.1523619242624; Fri, 13 Apr 2018 04:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523619242; cv=none; d=google.com; s=arc-20160816; b=yMtM0D1y2AK8QHpLjgD0d6LGk7EyGKZZ9SCid0C6UPdoFN9Y+AzY1NKTgoEhjdpk5a JdWyv38K2qcOmdqWPykYh9v9bVst40p6Gq16C1mryj1FbSi4hs/Pk1uZMBTfq8MvUTk0 iQDS/o+M5ZrYYTlfhVE19yhKZrWtjhGW8yYpXxXAKdEqIx9Yw0h1uIapm0nV4mPqJus4 3Jjj9zeKX46Pi/9M9JmiPPhCC+zpO3OijrMbdZrgBINt/IHGRrmWSgEzlo7pdnD819/7 cOeDARAc0PMastXXAeaIJa8X4lxp78QGDgVW3k2vh4TD3Q3OiINyOeYCs7l5PJ4n7WEy caYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:mime-version:in-reply-to:user-agent :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=rAERKM6nH413Ay451Pm6DLYVBAAGjtL+fRGrzaLMcbY=; b=qk7+x4R2iBpABLLi2sa8dNvi6Mbvu3Gg/gA9kmhYBjIEIbsSjBz/7hL+GAZDJJ0pK9 rC/3Y3oxPaQZ+hgY4Ygbsfk4+JWvSrRxCjoKjE8qPOEieIlHxw1wk8LHnr5n78/h/20A 9hB8BB1tWYslxkkpbGUmRna/rCa+hNUmFTfmtdlyzL+yc1YZ6HFwIRKo5CE6D1aTvAnl rnEkh+Vu3gFVjKbkh7LTtTdrpOPxEb6+TpTQ+9aInl0t8tSCgWRm7Rn8rRrlBtgTODjK diGXrhLzYuob67NqQcSDMk+vcimpnvffd9fuC9CP+MP9MHvZRyKL6ZVklNfEhNptHdko 4qXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JUtqtwQS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si4462814pfe.168.2018.04.13.04.33.48; Fri, 13 Apr 2018 04:34:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JUtqtwQS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbeDMIuv (ORCPT + 99 others); Fri, 13 Apr 2018 04:50:51 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:52268 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbeDMIus (ORCPT ); Fri, 13 Apr 2018 04:50:48 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180413085046epoutp0259bb19e02d57126729ff9ed77993f5da~k8rgWWeX11518115181epoutp02c; Fri, 13 Apr 2018 08:50:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180413085046epoutp0259bb19e02d57126729ff9ed77993f5da~k8rgWWeX11518115181epoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523609446; bh=rAERKM6nH413Ay451Pm6DLYVBAAGjtL+fRGrzaLMcbY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=JUtqtwQS0pWGsW2RoBEJD2OvE9swYjkPUzgWnvxlzVK3ZgfL77wynidXT/w9R+H9I wPbnoZnPq0W8gyggITjt1kq8/nnwMpJ6SWkUx+W/nbPu2gndLdu9NU1qmdJDDZzO1w albFD1El28SxHj11VqSD0SL8ozQtGtGdZ9IdOmI0= Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20180413085046epcas1p21964c3f4585ed90279018f376790835c~k8rgJM4Zt3265432654epcas1p2V; Fri, 13 Apr 2018 08:50:46 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 87.10.04226.66F60DA5; Fri, 13 Apr 2018 17:50:46 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180413085045epcas1p3477a28ac1b06792533cc86464b5564fa~k8rfzdxK_0670606706epcas1p3M; Fri, 13 Apr 2018 08:50:45 +0000 (GMT) X-AuditID: b6c32a38-d73ff70000001082-99-5ad06f664eb1 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7B.47.03849.56F60DA5; Fri, 13 Apr 2018 17:50:45 +0900 (KST) Received: from amdc3058.localnet ([106.120.53.102]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7400C3R8KK8AB0@mmp1.samsung.com>; Fri, 13 Apr 2018 17:50:45 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Linus Torvalds , Zhang Rui , LKML , Linux PM list , "Li, Philip" Subject: Re: [GIT PULL] Thermal management updates for v4.17-rc1 Date: Fri, 13 Apr 2018 10:50:43 +0200 Message-id: <3639670.ds6gqUTXoT@amdc3058> User-Agent: KMail/4.13.3 (Linux/3.13.0-96-generic; KDE/4.13.3; x86_64; ; ) In-reply-to: <20180413040855.GA29826@localhost.localdomain> MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset="us-ascii" X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHIsWRmVeSWpSXmKPExsWy7bCmgW5a/oUog/u/uCzmX7nGanF51xw2 i8+9RxgtLh26yGTx5GEfm8WjvrfsDmweO2fdZfdYvOclk8eJGb9ZPD5vkgtgieKySUnNySxL LdK3S+DKWHxwP1PBI+WKF9P/sTUwHpHpYuTkkBAwkbjfsoKti5GLQ0hgB6NET28blPOdUeLF 6icsXYwcYFXveqxBGoQEdjNK7Gnygaj5yiix+v1ZVpAEm4CVxMT2VYwgtoiAlsSJS9uZQIqY BU4xSnRvucAEkhAWcJBo2HANbCiLgKrEkddgYV4BTYmTazrZQWxRAS+JLfvamUBKOAWsJSb0 5kOUCEr8mHyPBcRmFpCX2Ld/KiuErSNx9tg6RpBVEgJb2CQ+/T3CBvGZi8Tq4+/ZIWxhiVfH t7BD/CItcemoLUR9M6PEtx17mCFqJgA9tl4IwraWOHz8ItQCPol3X3tYIXp5JTraoEo8JL5+ v8kKYTtKfJ6/gQUSPlsZJRaelJrAKDsLydmzkJw9C8nZCxiZVzGKpRYU56anFhsWmOgVJ+YW l+al6yXn525iBKcCLYsdjHvO+RxiFOBgVOLhVag8HyXEmlhWXJl7iFGCg1lJhLdZ5kKUEG9K YmVValF+fFFpTmrxIUZpDhYlcd6nPmeihATSE0tSs1NTC1KLYLJMHJxSDYwV6Xe2ub6YtnTx V6/2jT89gpeJKfd+e9y6guv6xZ3B/vfSfhZ2RUp9tt25Wc/nkkx936FEzX16Mpmv5t46yhJa n+shM+/4pz87szZYmBjWH+U/U2upzqmt1ca6SN4gqiPkjKjtpDLDTar/DyaG75wULlv3OCiK oWXZ68Aa3z3CWS6OjWv01ymxFGckGmoxFxUnAgBHytA2AQMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsVy+t9jAd3U/AtRBuvu6FnMv3KN1eLyrjls Fp97jzBaXDp0kcniycM+NotHfW/ZHdg8ds66y+6xeM9LJo8TM36zeHzeJBfAEsVlk5Kak1mW WqRvl8CVsfjgfqaCR8oVL6b/Y2tgPCLTxcjBISFgIvGux7qLkYtDSGAno8SkHfdZIJyvjBK/ pi9l7WLk5GATsJKY2L6KEcQWEdCSOHFpOxNIEbPAKUaJd32LWEASwgIOEg0brrGATGURUJU4 8poJJMwroClxck0nO4gtKuAlsWVfOxNICaeAtcSE3nyIXVsZJS6f/8YMUS8o8WPyPbCRzALy Evv2T2WFsLUk1u88zjSBkX8WkrJZSMpmISlbwMi8ilEytaA4Nz232KjAMC+1XK84Mbe4NC9d Lzk/dxMjMIC3Hdbq28F4f0n8IUYBDkYlHl6FyvNRQqyJZcWVuYcYJTiYlUR4m2UuRAnxpiRW VqUW5ccXleakFh9ilOZgURLnvZ13LFJIID2xJDU7NbUgtQgmy8TBKdXA2GVRknauw+Kqsdlm Bt3ohum8ind51LKXHrzKH9/9niFravTTxFaPZ+sU93//FS87f9fuL9r3zpwMZY/6eukwQ9ec 6PQjK/1D6g0cKmSuPCq6nr85b726cfMay7mn8v8pO2i66Kqm7VD7XFMkpnpw8d/YVbG8RbcF 7daefxE9iSn9UPzdJxmhSizFGYmGWsxFxYkAAiH2o1wCAAA= X-CMS-MailID: 20180413085045epcas1p3477a28ac1b06792533cc86464b5564fa X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20180413040901epcas4p1c3c515567fb6ab613c018cd7229c4bd4 X-RootMTR: 20180413040901epcas4p1c3c515567fb6ab613c018cd7229c4bd4 References: <1523436077.16235.5.camel@intel.com> <20180413040855.GA29826@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, April 12, 2018 09:08:57 PM Eduardo Valentin wrote: > Hello, Hi, > On Thu, Apr 12, 2018 at 09:55:19AM -0700, Linus Torvalds wrote: > > On Wed, Apr 11, 2018 at 10:08 PM, Zhang Rui wrote: > > > > > > could you please illustrate me what the kconfig & warning is? > > > > Just "make allmodconfig" and the warning is about a uninitialized variable. > > > > Line 304 in drivers/thermal/samsung/exynos_tmu.c if my shell history > > is to be believed. > > > > Linus > > Yeah, this has also passed my local compilation error. Somehow my gcc4.9 > is not catching it. Using an older gcc (gcc4.6) does catch it. > > Anyways, given that the conversion functions are written to cover > for unexpected cal_type, the right way of fixing this is to rewrite > the conversion functions to allow for returning error codes and > adjusting the callers as expected. > > Rui, bzolnier, please consider the following fix: > > From 2aaf94f80c0021a21b4122c9f4197acff08ea398 Mon Sep 17 00:00:00 2001 > From: Eduardo Valentin > Date: Thu, 12 Apr 2018 21:00:48 -0700 > Subject: [PATCH 1/1] thermal: exynos: fix compilation warning around > conversion functions > > In order to fix the warns: > drivers/thermal/samsung/exynos_tmu.c:931:37: warning: 'temp' may be used uninitialized in this function [-Wmaybe-uninitialized] > drivers/thermal/samsung/exynos_tmu.c:304:9: warning: 'temp_code' may be used uninitialized in this function [-Wmaybe-uninitialized] > > the conversion functions should allow return error codes > and the not mix the converted value with error code. > > This patch change the conversion functions to return > error code or success and adjusts the callers accordingly. > > Signed-off-by: Eduardo Valentin > --- > drivers/thermal/samsung/exynos_tmu.c | 120 ++++++++++++++++++++++++----------- > 1 file changed, 84 insertions(+), 36 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c > index 2ec8548..b3f0704 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -282,52 +282,54 @@ static void exynos_report_trigger(struct exynos_tmu_data *p) > * TMU treats temperature as a mapped temperature code. > * The temperature is converted differently depending on the calibration type. > */ > -static int temp_to_code(struct exynos_tmu_data *data, u8 temp) > +static int temp_to_code(struct exynos_tmu_data *data, u8 temp, int *temp_code) > { > - int temp_code; > + int ret = 0; > > switch (data->cal_type) { > case TYPE_TWO_POINT_TRIMMING: > - temp_code = (temp - EXYNOS_FIRST_POINT_TRIM) * > + *temp_code = (temp - EXYNOS_FIRST_POINT_TRIM) * > (data->temp_error2 - data->temp_error1) / > (EXYNOS_SECOND_POINT_TRIM - EXYNOS_FIRST_POINT_TRIM) + > data->temp_error1; > break; > case TYPE_ONE_POINT_TRIMMING: > - temp_code = temp + data->temp_error1 - EXYNOS_FIRST_POINT_TRIM; > + *temp_code = temp + data->temp_error1 - EXYNOS_FIRST_POINT_TRIM; > break; > default: Since this condition cannot happen (the driver makes sure of this during probe) I would prefer much simpler fix from Arnd: https://patchwork.kernel.org/patch/10313313/ (I've already ACKed it two weeks ago). > WARN_ON(1); > + ret = -EINVAL; > break; > } > > - return temp_code; > + return ret; > } > > /* > * Calculate a temperature value from a temperature code. > * The unit of the temperature is degree Celsius. > */ > -static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) > +static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code, int *temp) > { > - int temp; > + int ret = 0; > > switch (data->cal_type) { > case TYPE_TWO_POINT_TRIMMING: > - temp = (temp_code - data->temp_error1) * > + *temp = (temp_code - data->temp_error1) * > (EXYNOS_SECOND_POINT_TRIM - EXYNOS_FIRST_POINT_TRIM) / > (data->temp_error2 - data->temp_error1) + > EXYNOS_FIRST_POINT_TRIM; > break; > case TYPE_ONE_POINT_TRIMMING: > - temp = temp_code - data->temp_error1 + EXYNOS_FIRST_POINT_TRIM; > + *temp = temp_code - data->temp_error1 + EXYNOS_FIRST_POINT_TRIM; > break; > default: > WARN_ON(1); > + ret = -EINVAL; ditto > break; > } > > - return temp; > + return ret; > } Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics