Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2802371rwb; Mon, 3 Oct 2022 05:56:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6deqevvKYoI+FQJMr5jZMGba2hvRF6xDs1r07Nnp15m/hpAX1i2gaVSBGgvtys00kgzVoq X-Received: by 2002:a17:907:2bf6:b0:78a:e9e4:e98f with SMTP id gv54-20020a1709072bf600b0078ae9e4e98fmr4203077ejc.562.1664801801181; Mon, 03 Oct 2022 05:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664801801; cv=none; d=google.com; s=arc-20160816; b=rQs/sPHrMeeL3LLqRm8DmwlXGJFA/uk5Jw6mQBM5t1Dci4PK3QdC8roWzgVTy0C7GV W6a84Klpu19ESRGwjmqxJLc/NkWFVqhzVYe/MqBgK6Ngstmg4bl1bEIqgl12WC2PJlfd B/HM4sPeqlZ//qtVCL9bMHay6huqsNjenHnj6JV1WqKm8QF9hHMPs/NGvA5qEqq66YJg t6pXiCdKhRopNdykyUZ9siZshhpoKvu+9jTHUOwZqZZ1muhYxx/34ZvbKPsJxoC+UmL0 xHLSX3e8WYLi7RRnSsBjZ+QQI8cy9usMgm0dbp2x5CAAso51O0NzpX26GJdJgmI+u0nz STjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :in-reply-to:content-language:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=xxukKcIyMl6TAaYB4bWz21KJ4pChE4zLufvzZqkUPiM=; b=tDT9uz4cnpgDGHTUqYMI+D/YTj/Gq4L02Lp4yjETVTFBX6peTR0uWTeA8/DQVJR95c ptoip07yCq7zeKPXem1xbxy9jkOj+qLdNoC4Dhoo6ZWcYyqp2UBW4zoF7IOsE9p5RPda JQQ1luCkiIVbR5CG36JnI8MZGPT0C3kPbXD4ivgIXfVLrjb9v8wWTcAvVfASAECc5kPk nP0qiHlpb0EHKNP0XflcIJ6w60p55GxXJi3zI4x8MOpOrLS0RUOToGEdo8Covr1DyIgy x+ddfsKIJlM0T1E5qaEyEcVloue8NuBlYGAjZwy87iju3EBhYOtMugUQhvwAnTIpbzt2 piew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=iZ4gYmGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga24-20020a1709070c1800b00780d2b861cfsi7653390ejc.389.2022.10.03.05.56.14; Mon, 03 Oct 2022 05:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=iZ4gYmGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229741AbiJCMuz (ORCPT + 99 others); Mon, 3 Oct 2022 08:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbiJCMuu (ORCPT ); Mon, 3 Oct 2022 08:50:50 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 739862ED6D for ; Mon, 3 Oct 2022 05:50:48 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20221003125043euoutp023ea52880b3f5ff7e2f53f2816639fef9~akBeQZMkD0192101921euoutp02E for ; Mon, 3 Oct 2022 12:50:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20221003125043euoutp023ea52880b3f5ff7e2f53f2816639fef9~akBeQZMkD0192101921euoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664801443; bh=xxukKcIyMl6TAaYB4bWz21KJ4pChE4zLufvzZqkUPiM=; h=Date:From:Subject:To:Cc:In-Reply-To:References:From; b=iZ4gYmGrI4/TnmZO6prPTobhWOAHjrf1Ncf3jp+fOvg5TmT/afUR7eR10b1PVJf40 eo3iBxSRcOuu7ieVDdljXm2Qd8+/ibSQi6phYYtIA+T7eIKcSU9oXcmmdZcuLJV+gU 0JfFMMPhlEQjMyeLyub1uU1y9BxzNLVR6cZHSck0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20221003125041eucas1p1357a303d968bd0881acc30e17c2ffc51~akBdJJ1qY2618226182eucas1p1l; Mon, 3 Oct 2022 12:50:41 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 65.7D.29727.1AADA336; Mon, 3 Oct 2022 13:50:41 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20221003125041eucas1p2dd08002bc6becbd612d6b43d620ef26f~akBcrL-Vl0820408204eucas1p2W; Mon, 3 Oct 2022 12:50:41 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221003125041eusmtrp23bcbc52482cad86024a2622a1546795a~akBcqIT131710517105eusmtrp2T; Mon, 3 Oct 2022 12:50:41 +0000 (GMT) X-AuditID: cbfec7f2-205ff7000001741f-43-633adaa1f5e5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2B.A8.10862.1AADA336; Mon, 3 Oct 2022 13:50:41 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20221003125040eusmtip23aadbd77d4ae0893dc5699f91bf46490~akBcFOaes2627626276eusmtip2Y; Mon, 3 Oct 2022 12:50:40 +0000 (GMT) Message-ID: <4e4d873b-4a40-334a-34e7-defb0fcc4e6b@samsung.com> Date: Mon, 3 Oct 2022 14:50:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 From: Marek Szyprowski Subject: Re: [PATCH v8 19/29] thermal/of: Remove of_thermal_get_crit_temp() To: Daniel Lezcano , rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org Content-Language: en-US In-Reply-To: <20221003092602.1323944-20-daniel.lezcano@linaro.org> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGKsWRmVeSWpSXmKPExsWy7djP87oLb1klGzRvM7Z4MG8bm8X3LdeZ LOZ9lrXY+3oru8Wmx9dYLS7vmsNmMXtJP4vF594jjBYzzu9jsuj8MovNYu6XqcwO3B47Z91l 99i0qpPN4861PWwem5fUe/RtWcXo8XmTXABbFJdNSmpOZllqkb5dAlfGvPvT2AtOiFd8XPGd qYHxm3AXIyeHhICJxKGPF1i6GLk4hARWMEqsaHrDBuF8YZRoX7qLCcL5zChxYPlvdpiWDaua oKqWM0qs6mxlBkkICXxkl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fTublNSczLLUIn27BL2MefensRecEK/4uOI7UwPjN+EuRk4OCQETiQ2rmthA bCGBpYwSDw+KQ8RlJE5Oa2CFsIUl/lzrAqrhAqp5zyixa8IVZpAEr4CdxO01D8CKWARUJN6e bGaDiAtKnJz5hAXEFhVIlnj5ZyI7iM0mYCjR9bYLrEZYwFviZPtXsDkiAo4SX/4uYgdZwCxw mUli8cUmdohtZxgl9v7dzwhSxSwgLnHryXwmEJtTwEniX+dkdoi4mUTX1i6oGnmJ5q2zmScw Cs1CcsgsJO2zkLTMQtKygJFlFaNIamlxbnpusZFecWJucWleul5yfu4mRmCUbjv2c8sOxpWv PuodYmTiYDzEKMHBrCTCO0XRMlmINyWxsiq1KD++qDQntfgQoykwNCYyS4km5wPTRF5JvKGZ gamhiZmlgamlmbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA9NKoamXZsVMSmJvmHP/1e/7 Ppu+ze6RiOTU++PJ6xVZN3vKW2PZNec+pnTtC/EysPP2Mvux3ufQ0qP2/wIeHtJZvllw7Z5V wp8WpR9+ELmBQ8DupMQf00bhFZ5ZDwqOqFxc3CSnHe3w9o/8PxtpU8mZTu7z3yzPLX1V0nks /kvJTXcJaf4rzHYTXje/3bd5j+MRo56Xl+aYLo+4pFT/STVy6c7lN7JOLn5dxM0gbC+YfeDa RTXP4LDZkTua9px8megefPH4koa5M87NKppgMcPww7avaXJZ/kqVrUqhl0y5IzTnmfGL+6/t CD24WDn7oi/X2aVLS5fqS5qFbl2fnmChml3/6Hph5JuYTZufGMxUYinOSDTUYi4qTgQAlYs8 vlsDAAA= X-CMS-MailID: 20221003125041eucas1p2dd08002bc6becbd612d6b43d620ef26f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20221003093207eucas1p1d456288f35eadbc6fcda0bf24b58e678 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20221003093207eucas1p1d456288f35eadbc6fcda0bf24b58e678 References: <20221003092602.1323944-1-daniel.lezcano@linaro.org> <20221003092602.1323944-20-daniel.lezcano@linaro.org> X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On 03.10.2022 11:25, Daniel Lezcano wrote: > The generic version of of_thermal_get_crit_temp() can be used. Let's > remove this ops which is pointless. > > Signed-off-by: Daniel Lezcano This patch breaks Exynos thermal driver as it introduces a NULL pointer dereference in exynos_tmu_initialize(): 8<--- cut here --- Unable to handle kernel NULL pointer dereference at virtual address 00000000 [00000000] *pgd=00000000 Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc1-00072-ge521efddb107 #12941 Hardware name: Samsung Exynos (Flattened Device Tree) dwc2 12480000.hsotg: new address 125 PC is at 0x0 LR is at exynos_tmu_initialize+0x4c/0x1e8 ... Process swapper/0 (pid: 1, stack limit = 0x(ptrval)) Stack: (0xf082dd78 to 0xf082e000) ...  exynos_tmu_initialize from exynos_tmu_probe+0x2b0/0x728  exynos_tmu_probe from platform_probe+0x5c/0xb8  platform_probe from really_probe+0xe0/0x414  really_probe from __driver_probe_device+0xa0/0x208  __driver_probe_device from driver_probe_device+0x30/0xc0  driver_probe_device from __driver_attach+0xf0/0x1f0  __driver_attach from bus_for_each_dev+0x70/0xb0  bus_for_each_dev from bus_add_driver+0x174/0x218  bus_add_driver from driver_register+0x88/0x11c  driver_register from do_one_initcall+0x64/0x380  do_one_initcall from kernel_init_freeable+0x1c0/0x224  kernel_init_freeable from kernel_init+0x18/0x12c  kernel_init from ret_from_fork+0x14/0x2c Exception stack(0xf082dfb0 to 0xf082dff8) ... Code: bad PC value ---[ end trace 0000000000000000 ]--- If there is no replacement for tzd->ops->get_crit_temp(tzd, &temp), then please simply remove that call in exynos_tmu_initialize() to avoid breaking the initialization. > --- > drivers/thermal/thermal_of.c | 15 --------------- > 1 file changed, 15 deletions(-) > > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c > index 494e9c319541..bd872183e521 100644 > --- a/drivers/thermal/thermal_of.c > +++ b/drivers/thermal/thermal_of.c > @@ -19,20 +19,6 @@ > #include "thermal_core.h" > -static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, > - int *temp) > -{ > - int i; > - > - for (i = 0; i < tz->num_trips; i++) > - if (tz->trips[i].type == THERMAL_TRIP_CRITICAL) { > - *temp = tz->trips[i].temperature; > - return 0; > - } > - > - return -EINVAL; > -} > - > /*** functions parsing device tree nodes ***/ > static int of_find_trip_id(struct device_node *np, struct device_node > *trip) > @@ -529,7 +515,6 @@ struct thermal_zone_device > *thermal_of_zone_register(struct device_node *sensor, > goto out_kfree_trips; > } > - of_ops->get_crit_temp = of_ops->get_crit_temp ? : > of_thermal_get_crit_temp; > of_ops->bind = thermal_of_bind; > of_ops->unbind = thermal_of_unbind; Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland