diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-11-10 14:04:47 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-11-12 21:47:18 +0100 |
commit | 9782dd101f343d7f1cad824dc26ad355341e1f3b (patch) | |
tree | cba28c740f4bd16cbcebb0b03d314804b2e2c047 /drivers/thermal | |
parent | Merge back thermal control material for 6.13 (diff) | |
download | linux-9782dd101f343d7f1cad824dc26ad355341e1f3b.tar.xz linux-9782dd101f343d7f1cad824dc26ad355341e1f3b.zip |
thermal: testing: Simplify tt_get_tt_zone()
Notice that tt_get_tt_zone() need not use the ret variable in
the tt_thermal_zones list walk and make it return right after
incrementing the reference counter of the matching entry.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/6120304.lOV4Wx5bFT@rjwysocki.net
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/testing/zone.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c index c6d8c66f40f9..fb83d2501284 100644 --- a/drivers/thermal/testing/zone.c +++ b/drivers/thermal/testing/zone.c @@ -288,19 +288,14 @@ static struct tt_thermal_zone *tt_get_tt_zone(const char *arg) guard(mutex)(&tt_thermal_zones_lock); - ret = -EINVAL; list_for_each_entry(tt_zone, &tt_thermal_zones, list_node) { if (tt_zone->id == id) { tt_zone->refcount++; - ret = 0; - break; + return tt_zone; } } - if (ret) - return ERR_PTR(ret); - - return tt_zone; + return ERR_PTR(-EINVAL); } static void tt_put_tt_zone(struct tt_thermal_zone *tt_zone) |