From patchwork Mon Apr 16 10:11:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 133443 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3394196ljb; Mon, 16 Apr 2018 03:14:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4894k6PnXbMXugkcwvk0p1hkO7UpfbYMaeSLNZ0J/UDmMOuOZh67AQ+AACcgKQyTEdP5atb X-Received: by 2002:a17:902:4483:: with SMTP id l3-v6mr14413159pld.282.1523873640867; Mon, 16 Apr 2018 03:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523873640; cv=none; d=google.com; s=arc-20160816; b=lyhQbEpnkgz4M+2Cg6zfHZc34+vxQgEcHPvoixrhhj7sUZbz6t/B2d0qH8dqcSvoui +YTta4WObIgZkYteng2BHFn3keVclZegm1L2YPqC/o95dDglMIanLrK7AdvZkiZz4gID YhzydKySb9qxf7dEP23f/OCZheiT5Eekzws/j3i9z7osJ0nz+YF0AU/nhJfNJ39n0DGa UgXkfd+Q9ZnSgMc85XXAfDX2S+Li1ttSuxOmONIu5dJvWLc5yaJWxrw2pgdoKPi9mbPX VxvJmz3Iee/Kau8pCuha7DABSeTM7m4Uk2tDXOa7IZ8T0gEANj3xM4oCAsRj/BdoO8oW pgSQ== 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:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=x6pNjcyDccdULlnK2SzGdFFxNe8u0Y8YnzguHaESH1k=; b=pcHGvw6INwJALBQhIRVTlDp6Ri0SK6oJ/02R7krySCkGE281qToqN3zueVfsRiSydV kBiC6RI0k6eCRUfhAv4B++FaYqoA5zd5pvWd1Q1G2Ecxpms+0nvyimBHCB53Fljre1fX PfpN4/np5SWsOtcwxTLnGjHsY1xSIRyC4hsXc0MEDGWDv9vr5J/9CBboGvYkL4COOw77 iJHdq+Aqqlz5dc+uOhazkDiVh8yn8er+FpH28n2ZLRIkkT5CAwYjUz8AtxLzMEx4/J/u BGgThUm7dOwr9B+31rvCY3AUX6d+J7K9D0Lgl92JJpnC0WwJc4JGNDI5rJYd1sSY6Oie oqyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ErQrFzbp; 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 p23si2663173pgv.153.2018.04.16.03.14.00; Mon, 16 Apr 2018 03:14:00 -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=ErQrFzbp; 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 S1753819AbeDPKN5 (ORCPT + 29 others); Mon, 16 Apr 2018 06:13:57 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:31932 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753630AbeDPKNx (ORCPT ); Mon, 16 Apr 2018 06:13:53 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180416101351epoutp030e554f210e7368b5ee891fe3bcd70d9b~l4v6OxTQe1183911839epoutp03j; Mon, 16 Apr 2018 10:13:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180416101351epoutp030e554f210e7368b5ee891fe3bcd70d9b~l4v6OxTQe1183911839epoutp03j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523873631; bh=x6pNjcyDccdULlnK2SzGdFFxNe8u0Y8YnzguHaESH1k=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ErQrFzbpd8+8E/EsYunBI/rdSCB+UrXrKR/faUN0zu+DKClZnE/4boxq0e+XuDHyx OqTCQd682v/Ggf96tQdmqkynGKyvP8BBVzXQFwkFNc3fpYOwYxIO0NyX3eFkIvTo7b tGTqu9K8MnSqoQF43EQqG0a/CzV9Zt6FrBLv7g8s= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180416101351epcas1p38fa88f5ee25e510d8c14bfef9c839e26~l4v58EKXK0733907339epcas1p3g; Mon, 16 Apr 2018 10:13:51 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 75.8F.04084.F5774DA5; Mon, 16 Apr 2018 19:13:51 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180416101350epcas1p46d9415458ec463afb2a071a9f765f0ed~l4v441jHd2200722007epcas1p4p; Mon, 16 Apr 2018 10:13:50 +0000 (GMT) X-AuditID: b6c32a39-591ff70000000ff4-59-5ad4775fc631 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 23.AB.03849.E5774DA5; Mon, 16 Apr 2018 19:13:50 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P79000EEWCHS590@mmp2.samsung.com>; Mon, 16 Apr 2018 19:13:50 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , Krzysztof Kozlowski , Kukjin Kim , Daniel Lezcano , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com, Marek Szyprowski Subject: [PATCH 02/14] thermal: exynos: Propagate error value from tmu_read() Date: Mon, 16 Apr 2018 12:11:53 +0200 Message-id: <1523873525-23718-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsWy7bCmgW58+ZUog2krFCw2zljPajHvs6zF /CvXWC36H79mtjh/fgO7xeVdc9gsPvceYbSYcX4fk8XaI3fZLZ487GNz4PLYOesuu8fiPS+Z PDat6mTzuHNtD5tH35ZVjB6fN8kFsEVx2aSk5mSWpRbp2yVwZbxc9ZG94AV3xYW2k0wNjO85 uxg5OSQETCQe9N9jB7GFBHYwSmydI9fFyAVkf2eUeNx4lxWm6NTa/cwQiQ2MEm9/fmSCcH4x SkybOgusnU3ASmJi+ypGEFtEQEvixKXtYEXMAvuZJHqXzQUbJSzgLzF/bydYEYuAqsTO+V/B 4rwCHhJ3X79mg1gnJ3Hy2GSwOKeAp0TTmmtsIIMkBFawSXQemAeU4AByXCQap8dB1AtLvDq+ hR0iLC1x6agtRHkzo8S3HXuYIWomMErsWS8EYVtLHD5+EWw+swCfxLuvPVAjeSU62qBKPCRO X/wAdY6jRPOBs4wQD89hlDh6aTfTBEapBYwMqxjFUguKc9NTiw0LTPWKE3OLS/PS9ZLzczcx gmNXy3IH47FzPocYBTgYlXh4d5y9HCXEmlhWXJl7iFGCg1lJhHdZIlCINyWxsiq1KD++qDQn tfgQozQHi5I471OfM1FCAumJJanZqakFqUUwWSYOTqkGRnO/boO58Yvv63W2mW/5sal5kzCn CXcYQ+/jAy6bD8zlC3gbufaqgvOVopMHncqLH9gZifYefvH7pHry2sbHM21+Bd74eGri4odS f2olH3r0tAQKW7SuKd/E/7f918MJ7TeDKip9vZyFBVbKZKy4Xz1Xwkt8R3n7zi2Oaa6lb2/M 2rvonNxJSSWW4oxEQy3mouJEANM5E0XZAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsVy+t9jQd248itRBrumSVhsnLGe1WLeZ1mL +VeusVr0P37NbHH+/AZ2i8u75rBZfO49wmgx4/w+Jou1R+6yWzx52MfmwOWxc9Zddo/Fe14y eWxa1cnmcefaHjaPvi2rGD0+b5ILYIvisklJzcksSy3St0vgyni56iN7wQvuigttJ5kaGN9z djFyckgImEicWrufGcQWEljHKLFplWAXIxeQ/YtRYs7m86wgCTYBK4mJ7asYQWwRAS2JE5e2 M4EUMQvsZ5L4MO06C0hCWMBXonlmExOIzSKgKrFz/lewZl4BD4m7r1+zQWyTkzh5bDJYnFPA U6JpzTU2iM0eEo0TrzJOYORZwMiwilEytaA4Nz232KjAMC+1XK84Mbe4NC9dLzk/dxMjMNi2 Hdbq28F4f0n8IUYBDkYlHt4dZy9HCbEmlhVX5h5ilOBgVhLhXZYIFOJNSaysSi3Kjy8qzUkt PsQozcGiJM57O+9YpJBAemJJanZqakFqEUyWiYNTqoFx2vwi1fl/X53/5Vl+lzHGWpvJR2L2 Zc2jhkLpkZvnFpS8sxVkPXotk+07N3f5NxnLWTuyJ368taKotL7XbE6JW+GOf0Jqk8w9RK4c vM8XNkNsRqVertbzCMaS3rLlpRZsj6fV1d6rWLRB1IzjtNh8j6m/Nj8rP/FGMy9Y4HVzs6TF lQaG6ONKLMUZiYZazEXFiQCNtNHPMgIAAA== X-CMS-MailID: 20180416101350epcas1p46d9415458ec463afb2a071a9f765f0ed X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20180416101350epcas1p46d9415458ec463afb2a071a9f765f0ed X-RootMTR: 20180416101350epcas1p46d9415458ec463afb2a071a9f765f0ed References: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski tmu_read() in case of Exynos4210 might return error for out of bound values. Current code ignores such value, what leads to reporting critical temperature value. Add proper error code propagation to exynos_get_temp() function. Signed-off-by: Marek Szyprowski CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 986cbd0..ac83f72 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -892,6 +892,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) static int exynos_get_temp(void *p, int *temp) { struct exynos_tmu_data *data = p; + int value, ret = 0; if (!data || !data->tmu_read || !data->enabled) return -EINVAL; @@ -899,12 +900,16 @@ static int exynos_get_temp(void *p, int *temp) mutex_lock(&data->lock); clk_enable(data->clk); - *temp = code_to_temp(data, data->tmu_read(data)) * MCELSIUS; + value = data->tmu_read(data); + if (value < 0) + ret = value; + else + *temp = code_to_temp(data, value) * MCELSIUS; clk_disable(data->clk); mutex_unlock(&data->lock); - return 0; + return ret; } #ifdef CONFIG_THERMAL_EMULATION