From patchwork Wed Jan 20 05:45:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8068371 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 13FCA9F96D for ; Wed, 20 Jan 2016 05:45:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EA09202FF for ; Wed, 20 Jan 2016 05:45:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65245202E9 for ; Wed, 20 Jan 2016 05:45:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933438AbcATFpe (ORCPT ); Wed, 20 Jan 2016 00:45:34 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:5548 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933098AbcATFpc (ORCPT ); Wed, 20 Jan 2016 00:45:32 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 20 Jan 2016 14:45:30 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 72AFF4632A; Wed, 20 Jan 2016 14:45:28 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 55FE38002D; Wed, 20 Jan 2016 14:45:28 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 4BE048002F; Wed, 20 Jan 2016 14:45:28 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id QAC02941; Wed, 20 Jan 2016 14:45:28 +0900 X-IronPort-AV: E=Sophos;i="5.22,319,1449500400"; d="scan'";a="203877141" Received: from mail-sg2apc01lp0240.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.240]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 Jan 2016 14:45:27 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by SIXPR06MB1023.apcprd06.prod.outlook.com (10.160.240.28) with Microsoft SMTP Server (TLS) id 15.1.365.19; Wed, 20 Jan 2016 05:45:24 +0000 Message-ID: <877fj44xk5.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Eduardo Valentin CC: Zhang Rui , Simon , Magnus , Linux-Kernel , Subject: [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Wed, 20 Jan 2016 05:45:24 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: KAWPR01CA0044.jpnprd01.prod.outlook.com (25.165.48.154) To SIXPR06MB1023.apcprd06.prod.outlook.com (25.160.240.28) X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 2:K2Cy/oA7/NHSq9Cq+wrR0F++LkDTkYXeG3kz6V8RsyPqzXjEQS0a6fMtSsFamDJuaxlNM+b/1kyEIqynuQ4UpbBqhpZfmQt+WG04zZpb/2ithb5tTDBwZxERPfy9e+Y7+RK4EVHD3yCAkeAdCGUAPQ==; 3:aAJihjwqCui/t8IYBXASeywaMRV/4E+C/H1lnCY/HsQzTDVpGuYNQkEpNoFb1/1d1cMB9V6fEilsOYRXNVW+5Bej46D8Dzpo+knbbGpdVa0nUFTAlLhU4m6axpYpU5nx; 25:3MO7ryL6I0xdhm8MCZIJZqd3TSDRWNXLALeJHKa7Ucwt2qeNoe/QqFkHtgyz6+uoORay9MoIS9QxB1GtXNGmYZeYq3yzNjEBZO0GUtmEB6xKa7ZlnujDvHFHUxHD16wfateaQ3uJGbA4SHCbG9VuGvZ11dpgXLkDy3ll29nHNzcNPvxB5aqPZAb0V5iyaDa1R0bXziE9pXvzfyphYZ6J7W/5xBok+xhFS92ef/Q/I15Q3C8GkhVElvnEvFwtfNkU X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB1023; X-MS-Office365-Filtering-Correlation-Id: d6651183-4a95-47ab-9a27-08d3215ce531 X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 20:2x0XNS2soLAffbpN/VXP5chcc7luYWnHHZqee/dlVJewyAJ4GO5MStHNFGFiTu2C03c9r3KWt66wpBmVD29QYvS4Hp3Xuzgs02+5Hgujfbl6giJgPOFNE8xbwAnCuRyLoovDC4MPpCLRqr9+On2IJV8AxsgaavKI/mQavza71IpuH9sYm2TDCxv67BNx8ZRzdi+fLCoP+o9K7DQg96hx/yvVs7mCbpTtibmKOfOq4TDMlYD1KWqdpjOcAJUyjSH8kZSQdwA6TtMY11hPusop5cHWu+iljl1pN4deNI6bhi3vAi2E4JrRiTHsLKl3HfszfUJOuVmqVg7hFbFHmleYIoOZVZ6qq0O4/1a7OpAoK9+pRlUGT/OPn1xQeWfkDx289JAoeDpjpQvA3EJYi6sD9S2+P2G+mBhrpcynCZTVcNPFZIpXefNLGuv9JeuqeTC8orLb3o+m8W9p0VU/FAux7xItlygE3EzpfOW2I6k5eIkn3NnTB81j1x7xFMwG2p2j; 4:2yzPaRgIBg4I0tqVWilvuppwo+CTx2Q5VF0Tn8gPjdZJOnxqdQ73NybIN+ZHkq//vYE7IR9tWCHowLhVJMOEKO3djHWT4GenN264BCdIuAGGAMTIvmHi+m9mMmRnQOfvWjiuFzVr8nYWWlaTlgpZq1sqpNfRoZ2eQS6ySh4A+Qsnq5PfZwkpZxEvyGZy25uNM9PeJk7rpDS+0cuzXyUW0x6ERbHh1hjZkEqoVG1CtGh8kOZfUhb84w0MwWi6WDM009MFuPxtIoNU4JaGheCiOlTmRSgGv87yLGfTb291Kzyrx5mfcu1bdzV+5s6Ypz/e+dJst/jaNrO3wi2LJRIT4weGH/xLy+i7DpL+yfNR+wWRhU++WFdk6YivyUIjuOsu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:SIXPR06MB1023; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB1023; X-Forefront-PRVS: 0827D7ACB9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(4326007)(92566002)(50466002)(19580395003)(66066001)(87976001)(189998001)(1411001)(110136002)(2906002)(586003)(36756003)(86362001)(54356999)(50986999)(53416004)(46406003)(42186005)(33646002)(81156007)(19580405001)(5008740100001)(4001350100001)(122386002)(69596002)(106356001)(229853001)(77096005)(105586002)(5001960100002)(83506001)(6116002)(3846002)(23726003)(101416001)(40100003)(5004730100002)(97736004)(1096002)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB1023; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SIXPR06MB1023; 23:3DNX1egn7rgWypoWRELxmNdod0bdLVxjmx1FuCf21?= =?us-ascii?Q?1O21oCNGM9dUlz3W06zV7SPvIPXOaX269GjWzNScI7l6V9HxEExxS0MU41jF?= =?us-ascii?Q?f3Xq3ZEpixMOliLCVR8AapHXzqZ0CuFcv8SOYsojjq9oqTAYnQoU+NHK+5g2?= =?us-ascii?Q?uWl/Cz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uozQhFnf?= =?us-ascii?Q?PPFrtobvV60Yz3+AjXir5jHmyfdPZliSHoNJyMsb8cptvVwPw7EUWngs8ZgM?= =?us-ascii?Q?nE3I3NoyS8=3D?= X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 5:+rvaxLDGXEvsc5duumBqwAnPmtXFsJX0wDWSHFv/xpbBRZ6oN5rdV8RqN8/AcmwlHmyGMsp6q4O+upUQld1brkOXhHsUOr5VuY9VqYL9zv5xF4VOovQrAG/Eex77OFgVenxp0t8ccrPCcgc4q1HAsg==; 24:mAybdijZFV4RySXibnCF/Vxgz6L6ZQPvUbOGMMM6SLyZL5hQQvVpGOlvugvMalGX4uCrSD7xZszcMP+Ltv5mnXDU6nvLRfHDUj8lI7f247I=; 20:kY7czNPKqqRg0bsqoWMDLHWO5A5APhueDLxZISkDRfk4Uo/uiLKKIBmNt8S9MgHCvbJsC5l3oI7UstFEC4JMoVShPVIG7F7nOTRz5jUXsWabLosRsvJGC32fZMJKr4KZ0KMMBAJiJxUI29RLRHKi4NCZ96jnPMAnpVw1w3464gg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2016 05:45:24.8282 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB1023 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto It needs to check maximum trip size before using it. Otherwise, each driver might be called with unsupported trip. Reported-by: Magnus Damm Signed-off-by: Kuninori Morimoto --- drivers/thermal/thermal_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 7f7a3ca..9761f49 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -461,6 +461,9 @@ static void thermal_tripped_notify(struct thermal_zone_device *tz, kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg); } + if (tz->trips <= trip + 1) + goto unlock; + ret = tz->ops->get_trip_temp(tz, trip + 1, &upper_trip_temp); if (ret) goto unlock;