Received: by 10.192.165.148 with SMTP id m20csp1979062imm; Thu, 26 Apr 2018 04:59:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx49xNffNgFgKJq4RWMju1P5OLlQXO2Wqj4hezvItNIvGVF4IoifowOssJnmX1vhsn0av29FE X-Received: by 10.99.109.11 with SMTP id i11mr26701278pgc.276.1524743946922; Thu, 26 Apr 2018 04:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524743946; cv=none; d=google.com; s=arc-20160816; b=U3YH7czjwNqlOW2hCbeOIr4GRt2WpGu3u/KeC8JaBnWD7mZfOcpz0Lk79qsQtbMlzg jH2p1IZkayrG7uJy3PXHFYpsUm4ZRxSlSkscF9plQbTRJiVI0mINgWTzNkucG4otlNq6 OvZ/QjvQNGv16M8ATpzlp9MflRJ8c9FYsy3JnWkGfRaqsa+C7JuZFs7rCLVWv5YZvOop 2/JoT3Y5wmJ886XO5iltMrZjDVc9YSROcQlGTDBkTveInwX6mjl8LWPvdIfcEJBMJwy0 kb3YNwoHuMnvVYzUxOtFLjGI8W5Sk00OAAQg91xhWSHgxdNldDVRmaAJNPr7IETNnkb+ KPew== 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=xEO8bfVl/ij0UZIJXd7sK4oUwExDKQ9jbXYNX85ZtvI=; b=nji8FQzQBY72up8bpH9BJuCVyfWcHuqkECFvExfkvb0kYmqfy82pXdXE8PrY687FOE 4k7Cr38yLDoW1UrpDq9RBlS0O0hBOBOuJ7KTa+uPQNFp6BEyvtDtOmyQ77/NPhWmMcav 7pzrj3JtJTS+bd0DimZ5T2kY1iGiOJzJm+AzPp9Kkw/MaKpUX1ZdS8faAAPThL8PwYuI NaGODZyLMj9dIsHwZLDOUHHgsJlpijS48bP3jaqU7MBMjGGxdmUHy/8IQu0T5DmDiyi+ w1YoIYKIkY9XMBPhfTlg8kb9YTRBTzDnhQ4Ln6ogr29FWM1RgkpStHAegk5wB/nJUrEU 9c4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=vJCdxBMB; 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 v11si15908986pgt.61.2018.04.26.04.58.53; Thu, 26 Apr 2018 04:59:06 -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=vJCdxBMB; 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 S932078AbeDZL5N (ORCPT + 99 others); Thu, 26 Apr 2018 07:57:13 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21273 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755973AbeDZLwQ (ORCPT ); Thu, 26 Apr 2018 07:52:16 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180426115215epoutp03b14be3c332b5b5c59e4c7aceff5f3573~o_iqv0zYj2180121801epoutp03M; Thu, 26 Apr 2018 11:52:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180426115215epoutp03b14be3c332b5b5c59e4c7aceff5f3573~o_iqv0zYj2180121801epoutp03M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524743535; bh=xEO8bfVl/ij0UZIJXd7sK4oUwExDKQ9jbXYNX85ZtvI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=vJCdxBMBcGcSeU9t+umN6D95dZHVF9yZGnIaNKN7Nh0DWTdpPVXRv/KBnGUPsnwvV 6tc4R3q1z4IYGoSUgzNu/KrSL0UEqt2lxjeMsFl+YUJiOF3N1tRnqmAyBM1YC95FWM Opf96yAQQjDs2rsH+S/N3tAKgcvT2/B43/0HdObo= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180426115214epcas2p3d46b13c7b9445ece2148531689a52ac0~o_iqYLFG-0036100361epcas2p3s; Thu, 26 Apr 2018 11:52:14 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 46.6D.04113.E6DB1EA5; Thu, 26 Apr 2018 20:52:14 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180426115214epcas2p33003bbbe84310405c6871853f0df40e3~o_ip7iR370036100361epcas2p3q; Thu, 26 Apr 2018 11:52:14 +0000 (GMT) X-AuditID: b6c32a47-bdfff70000001011-af-5ae1bd6ee72b Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id CE.2B.03817.D6DB1EA5; Thu, 26 Apr 2018 20:52:14 +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 <0P7S00GD7JMBQG00@mmp2.samsung.com>; Thu, 26 Apr 2018 20:52:13 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 06/18] thermal: exynos: fix trips limit checking in get_th_reg() Date: Thu, 26 Apr 2018 13:51:21 +0200 Message-id: <1524743493-28113-7-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsWy7bCmqW7e3odRBjdPqFlsnLGe1WL+lWus Fpd3zWGz+Nx7hNFixvl9TBZPHvaxObB57Jx1l91j8Z6XTB59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVcePFK9aCnRwVvRMaWBsYm9m7GDk5JARMJDY+P83cxcjFISSwg1Hix5KNbBDOd0aJ Ndd+MMNUXT8/lR0isYFRYsqKfSwQzi9GiZtXHjCBVLEJWElMbF/FCGKLCGhJnLi0nQmkiFlg DqPErIbdQB0cHMICQRL/n8WD1LAIqEpsn9nLAmLzCnhItDd9YYXYJidx8thkMJtTwFPiwpEm sGUSAn9ZJfa3vWAEmSMh4CIx+UoaRL2wxKvjW6D+kZZ4tmojI0R9M6PEtx17oF6YwCixZ70Q hG0tcfj4RbAFzAJ8Eh2H/7JDzOSV6GiDKvGQuN69DyrsKNE/NwXiX6BXLsx6zDyBUWoBI8Mq RrHUguLc9NRiowJjveLE3OLSvHS95PzcTYzgCNRy38G47ZzPIUYBDkYlHt6AhQ+ihFgTy4or cw8xSnAwK4nwxrc+jBLiTUmsrEotyo8vKs1JLT7EKM3BoiTO2+B7JkpIID2xJDU7NbUgtQgm y8TBKdXAKPbg2cqlH5esd7+57OLTYPkjYZpWRldNZ5wQ/v+y4Db/ofwzv5mKuVPcDrAe1am6 7/GTKWXeiVmMd2JZVtnksyxrdTns/ilcOnZdqerdyev45trbaNm2rYiM63j+YMtmDcHfEVIT bVXZM+/H3Xo98ZWClvbWMN1tX71yZoQqXF7LXXicc3q0iBJLcUaioRZzUXEiAAKYWVa8AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpiluLIzCtJLcpLzFFi42I5/e+xoG7e3odRBreXsVtsnLGe1WL+lWus Fpd3zWGz+Nx7hNFixvl9TBZPHvaxObB57Jx1l91j8Z6XTB59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVcePFK9aCnRwVvRMaWBsYm9m7GDk5JARMJK6fnwpkc3EICaxjlHj0/zYrSEJI4Bej xKvzWSA2m4CVxMT2VYwgtoiAlsSJS9uZQBqYBeYwSjxfMYcJJCEsECDRdvUxmM0ioCqxfWYv C4jNK+Ah0d70hRVim5zEyWOTwWxOAU+JC0eaWCCWeUjc73vPNoGRZwEjwypGydSC4tz03GKj AqO81HK94sTc4tK8dL3k/NxNjMCQ2XZYq38H4+Ml8YcYBTgYlXh4AxY+iBJiTSwrrsw9xCjB wawkwhvf+jBKiDclsbIqtSg/vqg0J7X4EKM0B4uSOC9//rFIIYH0xJLU7NTUgtQimCwTB6dU A2N8iVtuRa7n1PKVK6eePLTi3YJ5d4xMNNgLJ00/I/rn86Hj277xK6m1+6Rvv/buW1zHquvM ejJsXxrvmqz9YrP/6PSLTouLLudPPKxveeZKyovKo6uU7ir75q7QfiIYz7npwRWx+4wHL0w+ cvVxxz2V0AXv17UVPDFZamPWVTCr1Erzb1Z1+WoHJZbijERDLeai4kQAfUXgKhUCAAA= X-CMS-MailID: 20180426115214epcas2p33003bbbe84310405c6871853f0df40e3 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180426115214epcas2p33003bbbe84310405c6871853f0df40e3 X-RootMTR: 20180426115214epcas2p33003bbbe84310405c6871853f0df40e3 References: <1524743493-28113-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 of_thermal_get_ntrips() may return value bigger than supported by a given SoC (i.e. on Exynos5422/5800) so fix the code to not iterate the loop for i values >= data->ntrip. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 5a64879..58cd68e 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -311,9 +311,9 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling) const struct thermal_trip * const trips = of_thermal_get_trip_points(tz); unsigned long temp; - int i; + int i, ntrips = min_t(int, of_thermal_get_ntrips(tz), data->ntrip); - for (i = 0; i < of_thermal_get_ntrips(tz); i++) { + for (i = 0; i < ntrips; i++) { if (trips[i].type == THERMAL_TRIP_CRITICAL) continue; -- 1.9.1