Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp477730rdd; Tue, 9 Jan 2024 09:43:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdl/L76DesSuKK+uznSWosYSd6CLhfob48LmuQ287TeQXdTQ/di5TIwtrPH1EJRImiaNzs X-Received: by 2002:a05:6870:b488:b0:205:ccc5:2740 with SMTP id y8-20020a056870b48800b00205ccc52740mr8064190oap.10.1704822235239; Tue, 09 Jan 2024 09:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704822235; cv=none; d=google.com; s=arc-20160816; b=zgFQhMrfGYcio/cIhKR7EWk/JOkPFFVQ4/C+qp6lYtfldMzv1HUuL4Sw3q+2d6Dfp5 GhklXpw9ovBMGu0DwoJpI5+w+HMvDRbNoWbYWD1xnx61CpvHsSXhaqhxzNIZs3Ly1qik nQvldlWpeKsKVDK6E+T6wcFVR3fcU9j+SN8cAlawLr34Jg1Rdmtp7OC0hlZ0ufuH7fdG 5kfz92+nAYocjScG8KFFwwjTn/HZ12G0PC8V8IqykDrzs/Of9RX5qTCwwEynwxGi/HqK eNxbeOcDSwZIG7NIBwN2k9hyG8d+GWc/JvezbzIUuN4Cc/gaJbojccvzBgs6qGr2156B rBAw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21180-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h37-20020a632125000000b005a1d88169casi1708921pgh.189.2024.01.09.09.43.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:43:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21180-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1D6E9B24F44 for ; Tue, 9 Jan 2024 17:43:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88A233B7A1; Tue, 9 Jan 2024 17:43:40 +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 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: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehledgledtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghp thhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 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)