Received: by 10.192.165.156 with SMTP id m28csp566665imm; Fri, 13 Apr 2018 04:12:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+83iBoGO4Y7MWVSmtvwXVuBBJ7T2f7fZlBbWctQRVUpQ+W7dxQA5sjbahm4qi1WdIm7G60 X-Received: by 10.101.68.129 with SMTP id l1mr1721272pgq.239.1523617955290; Fri, 13 Apr 2018 04:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523617955; cv=none; d=google.com; s=arc-20160816; b=i3xJjvt66xHbhvzDoCpqAvb/HxoWeHLMb3S4a5hQljC9ZUPGpeSV6aUyFO0Lf/iNut P4kUydO+xQDKpXJjjcEbsl3SkmIKYvM+/RxERbqse0JAxr5hoxNfGBfyiJhL5R2Yl1QX 7v7CHIiZhtm/vpiMVpl8xJGAmjipdLf4vwf4UZyAdr+KQQ5iawKvfoNG3DY//6LFMhbR rwuYQPf5lQikzaDQkRFKoO/vjBUsgsJ6nChXTAs8lPdQGmvb3lmxW3iKEb6iw2NuIO0P QE99y9x7K5GkihBPuaFZe9KpbBYr9w9py+8BRuhcTLVhhDQsyo/IXacUSBolxKVXAe7c +unw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=rLX+0H7yqTrvviau4vv4vK/K/AJAGdfp0F5UYYakf6o=; b=LbvQ+Zos4zaOQARSLTvgRo9XeDaQmtxDNqHmRXyQc6PZtz5VI4SUOWEg6BHIXeCBI0 aItiA+mUe7bwE2fwuryyaQWd104uDYnjsB6JwOvMxVPvzW64yuJgs7AlC+1rt0PRvj7W G0ZjEGgYSrT15BmowwVWbFP3pduwuqT6/tkElf3MwHuG/EKI/Ynzaocsqd54747Y1yLj AfCN3O1CVVzXOnrpt9A99BglJwzUqpK6vPP32mkypoTR2T3SsSxXGRoEXI6lHs2+n4RV /789XYht58EVYRHbEGlunaS9Dz+d+DcEtSSxIBjZGHjM8nq/F4W7xOFlXmuBSKlgCqg+ c/wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bh2ZUusC; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si3831668pgp.564.2018.04.13.04.12.21; Fri, 13 Apr 2018 04:12:35 -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=@linaro.org header.s=google header.b=bh2ZUusC; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754381AbeDMLK0 (ORCPT + 99 others); Fri, 13 Apr 2018 07:10:26 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38832 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754143AbeDMLKY (ORCPT ); Fri, 13 Apr 2018 07:10:24 -0400 Received: by mail-wm0-f51.google.com with SMTP id i3so3491052wmf.3 for ; Fri, 13 Apr 2018 04:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=rLX+0H7yqTrvviau4vv4vK/K/AJAGdfp0F5UYYakf6o=; b=bh2ZUusCUpq2UxVQzXOZPPZjOJDkfM861Jg3loZUDYEsxKE6pT+z+HvTCZcG9j9aZ2 iurW4kgYA68f57GK8qSgR+kMBgCVqHKjajIGpigaK6SUgyuOY8xljcR/wpzdIwijK0yZ 8/ID5AFruLRu6QWsz7EEKvjQ2NLdxY3mpeYLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rLX+0H7yqTrvviau4vv4vK/K/AJAGdfp0F5UYYakf6o=; b=S4rCxt1UeWzL9KWyDbfQE9qmY9MfKvMBczSi7B1I3QHcuSgZHvN/Uikq05vIal69c9 k7IjG9CSSfGGLQ/rBc8LiWilLaFcjyEm3dSJpxgj5yWYxZSlPDKyk6p3GFiY65ud2LzQ R8OrOGj+oZApbs1ShI8O5/IkVyHYRENRlp+9nKvJjUdLY5/LzUnDBm74WMg5ZlA8yr+a /Ij7c8pckEES/hp38E1V636VRA1I04GsSrbiWWb169Vw7GiigQkRMxnW4J0kSIRNKw5h QzmcK1D1y3Non1/BW9cG3IT98raQZ0ZYhi2RSdhpTskEwWX7FmDrv6ZAmNcJSoB6Ithp 63wA== X-Gm-Message-State: ALQs6tBRE4IMtcZMu8jQIBjjfG74cyk9y/nse+6SfoeO0d9lzRNAZsnj U0E3cwnVIPU6jEaeXTrrTb8c5A== X-Received: by 10.28.66.90 with SMTP id p87mr3597231wma.58.1523617823097; Fri, 13 Apr 2018 04:10:23 -0700 (PDT) Received: from [192.168.8.101] ([37.170.104.147]) by smtp.googlemail.com with ESMTPSA id q127sm6106139wmd.3.2018.04.13.04.10.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 04:10:22 -0700 (PDT) Subject: Re: [GIT PULL] Thermal management updates for v4.17-rc1 To: Bartlomiej Zolnierkiewicz Cc: Zhang Rui , Eduardo Valentin , Linus Torvalds , LKML , Linux PM list , "Li, Philip" References: <1523436077.16235.5.camel@intel.com> <4212243.RcCUWlsaar@amdc3058> <3b41052a-233d-9992-223a-d16f48295905@linaro.org> <10298074.ogKH1ypqfx@amdc3058> From: Daniel Lezcano Message-ID: <417cb724-2fcf-717f-63bf-9a479cc0d540@linaro.org> Date: Fri, 13 Apr 2018 13:10:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <10298074.ogKH1ypqfx@amdc3058> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/04/2018 12:41, Bartlomiej Zolnierkiewicz wrote: > On Friday, April 13, 2018 12:30:04 PM Daniel Lezcano wrote: >> On 13/04/2018 11:28, Bartlomiej Zolnierkiewicz wrote: >> >> [ ... ] >> >>>>> It is okay to return 0 because this code-path (the default one) will be >>>>> never hit by the driver (probe makes sure of it) - the default case is >>>>> here is just to silence compilation errors.. >>>> >>>> The init function is making sure cal_type is one or another. Can you fix >>>> it correctly by replacing the 'switch' by a 'if' instead of adding dead >>>> branches to please gcc? >>>> >>>> if (data->cal_type == TYPE_TWO_POINT_TRIMMING) { >>>> return ...; >>>> } >>>> >>>> return ...; >>> >>> I'm not the one that added this switch statement (it has been there since >>> 2011) and I would be happy to remove it. >> >> Actually the switch statement was fine until the cleanup. > > I don't see how it was fine before as the driver has never used the default > case (always used TYPE_ONE_POINT_TRIMMING or TYPE_TWO_POINT_TRIMMING). > > Could you please explain this more? From commit 480b5bfc16e17ef51ca1c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -260,7 +260,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp) temp_code = temp + data->temp_error1 - pdata->first_point_trim; break; default: - temp_code = temp + pdata->default_temp_offset; + WARN_ON(1); break; } @@ -287,7 +287,7 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) temp = temp_code - data->temp_error1 + pdata->first_point_trim; break; default: - temp = temp_code - pdata->default_temp_offset; + WARN_ON(1); break; } I'm not saying the code path was fine but from the compiler point of view, it was. By removing the defaulting temp value there is a code path gcc sees the temp variable as not initialized. Your cleanups are relevant. > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog