From 650a41c6d0f5e99a0de19538b2844c8ab13d6ca7 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Wed, 8 Jan 2020 11:30:42 +0000 Subject: [PATCH] regulator: fix regnode_method_get_voltage This method is supposed to write the voltage into uvolt and return an errno compatible value. Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D23006 --- sys/dev/extres/regulator/regulator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/extres/regulator/regulator.c b/sys/dev/extres/regulator/regulator.c index 40e786b8a4f4..967509afd381 100644 --- a/sys/dev/extres/regulator/regulator.c +++ b/sys/dev/extres/regulator/regulator.c @@ -275,8 +275,9 @@ static int regnode_method_get_voltage(struct regnode *regnode, int *uvolt) { - return (regnode->std_param.min_uvolt + - (regnode->std_param.max_uvolt - regnode->std_param.min_uvolt) / 2); + *uvolt = regnode->std_param.min_uvolt + + (regnode->std_param.max_uvolt - regnode->std_param.min_uvolt) / 2; + return (0); } int