public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Lukasz Luba <lukasz.luba@arm.com>
Subject: [PATCH v1 2/2] thermal: helpers: Rearrange thermal_cdev_set_cur_state()
Date: Tue, 09 Jan 2024 17:42:48 +0100	[thread overview]
Message-ID: <8343955.T7Z3S40VBb@kreacher> (raw)
In-Reply-To: <2193991.irdbgypaU6@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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 <rafael.j.wysocki@intel.com>
---
 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)




  parent reply	other threads:[~2024-01-09 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 16:39 [PATCH v1 0/2] thermal: core: Cleanups related to the netlink I/F Rafael J. Wysocki
2024-01-09 16:42 ` [PATCH v1 1/2] thermal: netlink: Rework notify API for cooling devices Rafael J. Wysocki
2024-01-09 17:28   ` Daniel Lezcano
2024-01-09 16:42 ` Rafael J. Wysocki [this message]
2024-01-09 17:29   ` [PATCH v1 2/2] thermal: helpers: Rearrange thermal_cdev_set_cur_state() Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8343955.T7Z3S40VBb@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox