Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2877387rwb; Mon, 3 Oct 2022 06:50:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7O21atyELxClexsiIhiN6eKcUYCmo/yWcS8S2AST3BD/WUshXs+8BjOXNy0FuihVbdpOcO X-Received: by 2002:a17:902:dac4:b0:178:2a6f:bc7f with SMTP id q4-20020a170902dac400b001782a6fbc7fmr22777758plx.129.1664805041081; Mon, 03 Oct 2022 06:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664805041; cv=none; d=google.com; s=arc-20160816; b=i31d6mWWVJBLTYJ/MWoucP0thKwZwOj+mQlGQNEHv/tcQbzmpZAMDe52Rb9LYTmMWG 3t6YAENFqYPwRDxUAfEWfTxfTI7tvqPVDYJu9ue12crTnR8BEt2DnUbhWklQja3sCOWc 8KGIm+na5dd6eotcIrfagmqM2LXK9DwjAOKXf49Lr4cSzIoka2GwO00znKJUXWkreQmQ Y7sDQiCg9qCnbaAacuv8P+tRYqFRJiLUIiNNyHg6q2LbEhaGCb5+TcY869gqjqDECBiq pfGyaYTSpA3+wX+DYdinLuKNmfCzbaIWzgR9HsNmnL/B8xPmtZokIJpdanB56YAtxgR+ Kp3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K+1rfxoYuPGVyugbqBQnz5TOkQnrFnazhzmXLe5x1kk=; b=SdijMMHIZREc17xOcqbK94nm5EFTJfe2Fvukyz+xFJUsrChiZLq9C8jzXmL/Zqwgur hPkbmgc0mgUezhSmmMsyuQhmFU7tqcfjMGzp8rn8Rk9Kdv0M8rsBXul0BqPh3ZujpEAm s00V3zxuDE3wROB+Kj3nU2bwm9yrDPOvtVix2iWE1QSlSsQbJ8WApbkYeIqRNElx3GP6 uZjRm5wy7o6whCRAXO+cQRtTrHoaYX8w5eOx2B8TMRv3QXRQLZz5K8nJjL4aGIrzr6J6 ThQzRkn9dDS9C/o+nMEIhr3Rl+DhZ5Pd/bxmrAh8JY0W83bBRQhq3Oix1Gz50YKHUebS 4K/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YdGNxZrD; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 38-20020a630c66000000b00439e032490csi10169028pgm.350.2022.10.03.06.50.29; Mon, 03 Oct 2022 06:50: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=@linaro.org header.s=google header.b=YdGNxZrD; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbiJCNaL (ORCPT + 99 others); Mon, 3 Oct 2022 09:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbiJCNaI (ORCPT ); Mon, 3 Oct 2022 09:30:08 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6401A17A86 for ; Mon, 3 Oct 2022 06:30:05 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id bk15so16737194wrb.13 for ; Mon, 03 Oct 2022 06:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=K+1rfxoYuPGVyugbqBQnz5TOkQnrFnazhzmXLe5x1kk=; b=YdGNxZrDeq2Ca5oDBn0BNqMa8Pd5/9myYbWwsZv1k5Wac00ZwsjY9ks1spfrTh9gus nJhnNAqYRyvk1MbskUc1n3ZLd1vQ4Gmgnde1f1i5FXKrLcBeA3oyS3cWU6V7LQjDxNCz /a93+1JnCWlFIaJgJRzWvHGXYj22l54rDzS49oyHOQ3gxGBChSVmMXIoC3DHVQBSMwai VPeJY6y0xqGq5+LHjQyl+we/zZzUgsgC9mqqjFmf8216XpWvzoOX9gHfKKcLujhZD1Rx Le+8s4Vrd9AwddaQvd0yyQ9JdG4RFrcTsm0UAJ2ll8y0FNkEJuK2hDaOrYbQhXk5uhzv NFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=K+1rfxoYuPGVyugbqBQnz5TOkQnrFnazhzmXLe5x1kk=; b=jbvi4ER08X1Nn3PJSa+13tEh4y72qowHnMpFUtfqSWsNMGpWpIN4h3GnPgQnGjw9nW WG+eQwsRZNbc3wRcsFyK7zGFZSi37RdkdHNWQTgnhchcUQNASnzYeFI6tFOCi4c6ovCt /5EIbqdjB9ndjyo28jCjvipqoPKqZQAQ8xV97S714GEjRL+WB95cTWsENZ2XwLfND/Oq kLGZEAyw6FTjRRuRNQprvCOxnPtCh/kb/pC2Y7iEXH4yelIwpMYEz6dIyYamvb5Dgmk5 Gp2BpXOGfBnSSikNJWJyhQhiJksZfiF4RjV91BbRPYlppan58exST2BPvCfEJg0qqpcC UO8Q== X-Gm-Message-State: ACrzQf20aENZFniagd3WgetsaC+axa4+f0MfHFkuReiYt5MZUvGG1JJf jBJasOgXJOqqOUTxKFi6WILXBA== X-Received: by 2002:a5d:65c4:0:b0:22c:dbdd:7177 with SMTP id e4-20020a5d65c4000000b0022cdbdd7177mr11291303wrw.470.1664803803837; Mon, 03 Oct 2022 06:30:03 -0700 (PDT) Received: from mai.. ([2a05:6e02:1041:c10:f3a:9f5e:1605:a75a]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c4f5500b003a5f54e3bbbsm18379931wmq.38.2022.10.03.06.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 06:30:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org, m.szyprowski@samsung.com Cc: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp Date: Mon, 3 Oct 2022 15:29:43 +0200 Message-Id: <20221003132943.1383065-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <4e4d873b-4a40-334a-34e7-defb0fcc4e6b@samsung.com> References: <4e4d873b-4a40-334a-34e7-defb0fcc4e6b@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,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 The driver is assuming the get_critical temperature exists as it is inherited by the thermal of ops. But this one has been removed in favor of the generic one. Use the generic thermal_zone_get_crit_temp() function instead Fixes: 13bea86623b ("thermal/of: Remove of_thermal_get_crit_temp(") Reported-by: Marek Szyprowski Signed-off-by: Daniel Lezcano --- drivers/thermal/samsung/exynos_tmu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 5a1ffe2f3134..37465af59262 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -264,9 +264,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) unsigned int status; int ret = 0, temp; - if (data->soc != SOC_ARCH_EXYNOS5433) /* FIXME */ - ret = tzd->ops->get_crit_temp(tzd, &temp); - if (ret) { + ret = thermal_zone_get_crit_temp(tzd, &temp); + if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ dev_err(&pdev->dev, "No CRITICAL trip point defined in device tree!\n"); goto out; -- 2.34.1