Skip to content

Commit 37f665f

Browse files
Samsagaxgroeck
authored andcommitted
hwmon: (oxp-sensors) Simplify logic of error return
Take return logic on error out of if-else, eliminating duplicated code in tt_togle_store() function. Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> Link: https://lore.kernel.org/r/20230617181159.32844-3-samsagax@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent d769621 commit 37f665f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/hwmon/oxp-sensors.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,12 @@ static ssize_t tt_toggle_store(struct device *dev,
226226

227227
if (value) {
228228
rval = tt_toggle_enable();
229-
if (rval)
230-
return rval;
231229
} else {
232230
rval = tt_toggle_disable();
233-
if (rval)
234-
return rval;
235231
}
232+
if (rval)
233+
return rval;
234+
236235
return count;
237236
}
238237

0 commit comments

Comments
 (0)