From patchwork Tue Jan 9 16:42:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 186485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp274796dyi; Tue, 9 Jan 2024 09:44:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHo7zYRv1xvwQI202/mpEzJ13pjUp4SkBg/+P8T2gsiZiF2HE7uhSTPv+WQI2EIFHuP6tH1 X-Received: by 2002:a25:9084:0:b0:dbd:5cc3:8355 with SMTP id t4-20020a259084000000b00dbd5cc38355mr2907033ybl.102.1704822251421; Tue, 09 Jan 2024 09:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704822251; cv=none; d=google.com; s=arc-20160816; b=WgO4mDt88zKNXCJUAobm84Qt9f3v2cAaX8SS3v99ICcKDygpHK2ww4gwVKIDOFvPHc sRlvbwy1TwTXur9gSPjFOgnIrQZFi/fHQLatheei0zI1iz7q04jsPE3YizApN7IBDanL 9mSdSvAimJuRdwPE4VnT2CU/1bOq05Y7lyu8OfWLq13tEh1YCOTlxpUAYAvPQzvbrW7d xOZkt8O5B0ilj2mHoKSuHAU91QIfkJPTfA8LO2BZZ5b4GznCVXG6xWfiOOZcA+nzKWU5 r9+rW5psGVslCc7T2hbgk8l6lXlZFLLSTUzXBmRQHiAaqyK4cZNumqfHlR0oCX7MIE6f WLjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=P2vHgoUx+Xw9Tshg2cVYRuelvtsij94VSFh5NyQAQCQ=; fh=p5JLzUeYmDtBILJqB4up17ENY0cI3Vp//WCZe0ToArA=; b=zd/93WTH9k6tdSx8GhznfxDxDt7cTAUxMr7kyr4D30U1npNJWgMtWbNkmbc3TX3JG5 RuA5SHkGSLHZasnC5zANGkAV6+OL6Wdjrz7ZNuTBS4E5Lp7qtzqK/g2YS6OQWjFP6tji 0xmW8KXxoWvadhjeix3X1AQhSn9fNsLKAtizLPF4LIKIcVgNt4aJqLrZVfUm8Hxj03x9 0appDCb+ejXtC3CAOmhyT4f/CqTFXDJMQBAf/XmeIBM8zFVytZCF3mjPbzlTy5pQ3Fh1 ekf682OxzFCMZYSRkDB7h2YITq8I3TiiwRb+e/3SSW9LqOkPTKdAqkorMKJ8oSBEiClx birQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21180-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21180-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g19-20020ac85813000000b004297765bc27si2538308qtg.549.2024.01.09.09.44.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:44:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21180-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21180-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21180-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3768D1C2399D for ; Tue, 9 Jan 2024 17:44:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D9523C06B; Tue, 9 Jan 2024 17:43:41 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC05038DF8; Tue, 9 Jan 2024 17:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net 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.4.0) id 2a299a0e4424d6f1; Tue, 9 Jan 2024 17:43:35 +0100 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 cloudserver094114.home.pl (Postfix) with ESMTPSA id 5B76C669107; Tue, 9 Jan 2024 17:43:35 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Daniel Lezcano , Srinivas Pandruvada , Zhang Rui , LKML , Lukasz Luba Subject: [PATCH v1 2/2] thermal: helpers: Rearrange thermal_cdev_set_cur_state() Date: Tue, 09 Jan 2024 17:42:48 +0100 Message-ID: <8343955.T7Z3S40VBb@kreacher> In-Reply-To: <2193991.irdbgypaU6@kreacher> References: <2193991.irdbgypaU6@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehledgledtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghp thhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787634819829003652 X-GMAIL-MSGID: 1787635696706884461 From: Rafael J. Wysocki Change the code layout in thermal_cdev_set_cur_state() so it returns early on errors which is more consistent with what happens elsewhere. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_helpers.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) Index: linux-pm/drivers/thermal/thermal_helpers.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_helpers.c +++ linux-pm/drivers/thermal/thermal_helpers.c @@ -155,13 +155,14 @@ static int thermal_cdev_set_cur_state(st * registering function checked the ops are correctly set */ ret = cdev->ops->set_cur_state(cdev, state); - if (!ret) { - thermal_notify_cdev_state_update(cdev, state); - thermal_cooling_device_stats_update(cdev, state); - thermal_debug_cdev_state_update(cdev, state); - } + if (ret) + return ret; - return ret; + thermal_notify_cdev_state_update(cdev, state); + thermal_cooling_device_stats_update(cdev, state); + thermal_debug_cdev_state_update(cdev, state); + + return 0; } void __thermal_cdev_update(struct thermal_cooling_device *cdev)