Message ID | 2702371.mvXUDI8C0e@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1246619vqi; Fri, 15 Sep 2023 11:37:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3oDUwD0S9NSzf5GcJSv2pp4jAcETv1gGNYnCgSyze1xwq4fShma6ucjaKCFOmUpfVlQA9 X-Received: by 2002:a05:6a21:7785:b0:14c:def2:6954 with SMTP id bd5-20020a056a21778500b0014cdef26954mr2897854pzc.36.1694803042604; Fri, 15 Sep 2023 11:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694803042; cv=none; d=google.com; s=arc-20160816; b=CDvHRJjCYLd7TVjUpkLTz3XPULB15otBPZUL+hTElVSyiMcn3e5a43+GS8ONhyDzS0 WrXi/6E0CoTyW9xUJle7/7xOUxdHXDyXXl1aDOHueWnXqzTBjxsH2T4UGilAbBF8OQZf Y8aCiWc4OXJmZsLQz1HheX2LLv9cmwZML7eWLsSi2KNlSJX081agieDa8obXnsJ2kmiH qEQX7bH9JbPUJgFw96O5lSjVL/Mah+1zS+NFIL1lS1SUPDycbqLKy8AVKA2vviNpFK3d tlNJGJnczQ68VZvZD/V0JZPTV/QhfIF8Foaesl7XidvsQzpoBMKXZJ+/+gmwXXzk96ve gS0g== 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 :message-id:date:subject:cc:to:from; bh=id0M/lf3y4X6SXxY8mNJ6YSxiKPziUHmtpnVqW23b0I=; fh=dtw/hNx4nL/4wIw/L8NwZa1KIasT1++j1kxVjR+5jx8=; b=hpJ6WIo/BVm//IccdTcHzP3PnBgDgu/vRekncidCcH2jvC9IcqmICz2UNU0WG8hqm4 KURdrQl1SYCQ5wC0ctX9hStTPel1+V+BCDOyND2BajcDxTHZO3GSJNrr392Kk+DT6x6+ 4CikOexjkEBBcZ0Nu0nlLEkMekY1sKFnzB1BpNuHHiTnAn6zBzCMy6/iRBlcefWXoAVU RmFeZnEgJQxU4fRTLPZeMyxK80XAg3d0Ve0iCEOHEeMjyBfokIpRkfFohOKNdBjIu4Gf 6gXfS/iC1l3PA2pgskMMGgX/yAiNX9lMn/QhXiYj2dkr4yynG6xCnOQTE7jCBrpV+LEW sSUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a21-20020a63e855000000b00566022bbcafsi3511475pgk.566.2023.09.15.11.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 11:37:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9B317809849C; Fri, 15 Sep 2023 11:36:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236489AbjIOSgM (ORCPT <rfc822;ruipengqi7@gmail.com> + 30 others); Fri, 15 Sep 2023 14:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236470AbjIOSfm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 14:35:42 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A331FF5; Fri, 15 Sep 2023 11:35:35 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 1570012d61148707; Fri, 15 Sep 2023 20:35:34 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=<UNKNOWN>) Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id BF29E664080; Fri, 15 Sep 2023 20:35:33 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Zhang Rui <rui.zhang@intel.com> Subject: [PATCH v1] thermal: sysfs: Fix trip_point_hyst_store() Date: Fri, 15 Sep 2023 20:35:33 +0200 Message-ID: <2702371.mvXUDI8C0e@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudejvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghl rdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:36:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777129795202661023 X-GMAIL-MSGID: 1777129795202661023 |
Series |
[v1] thermal: sysfs: Fix trip_point_hyst_store()
|
|
Commit Message
Rafael J. Wysocki
Sept. 15, 2023, 6:35 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> After commit 2e38a2a981b2 ("thermal/core: Add a generic thermal_zone_set_trip() function") updating a trip point temperature doesn't actually work, because the value supplied by user space is subsequently overwritten with the current trip point hysteresis value. Fix this by parsing the number string supplied by user space after retrieving the current trip point data from the thermal zone. Also drop a redundant tab character from the code in question. Fixes: 2e38a2a981b2 ("thermal/core: Add a generic thermal_zone_set_trip() function") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 6.3+ <stable@vger.kernel.org> # 6.3+ --- drivers/thermal/thermal_sysfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1) return -EINVAL; - if (kstrtoint(buf, 10, &trip.hysteresis)) - return -EINVAL; - mutex_lock(&tz->lock); if (!device_is_registered(dev)) { @@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev ret = __thermal_zone_get_trip(tz, trip_id, &trip); if (ret) goto unlock; - + + ret = kstrtoint(buf, 10, &trip.hysteresis); + if (ret) + goto unlock; + ret = thermal_zone_set_trip(tz, trip_id, &trip); unlock: mutex_unlock(&tz->lock);