summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/cpcap-regulator.c
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2018-04-18 08:54:18 -0700
committerMark Brown <broonie@kernel.org>2018-04-20 12:45:36 +0100
commit02f3703934a42417021405ef336fe45add13c3d1 (patch)
tree019ba0938eb2d145ab06fe736b00a490c618ab50 /drivers/regulator/cpcap-regulator.c
parent669ca0303ac93adba0e046d414165250861efdb7 (diff)
downloadlinux-0-day-02f3703934a42417021405ef336fe45add13c3d1.tar.gz
linux-0-day-02f3703934a42417021405ef336fe45add13c3d1.tar.xz
regulator: Don't return or expect -errno from of_map_mode()
In of_get_regulation_constraints() we were taking the result of of_map_mode() (an unsigned int) and assigning it to an int. We were then checking whether this value was -EINVAL. Some implementers of of_map_mode() were returning -EINVAL (even though the return type of their function needed to be unsigned int) because they needed to signal an error back to of_get_regulation_constraints(). In general in the regulator framework the mode is always referred to as an unsigned int. While we could fix this to be a signed int (the highest value we store in there right now is 0x8), it's actually pretty clean to just define the regulator mode 0x0 (the lack of any bits set) as an invalid mode. Let's do that. Fixes: 5e5e3a42c653 ("regulator: of: Add support for parsing initial and suspend modes") Suggested-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/cpcap-regulator.c')
-rw-r--r--drivers/regulator/cpcap-regulator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c
index f541b80f1b540..bd910fe123d98 100644
--- a/drivers/regulator/cpcap-regulator.c
+++ b/drivers/regulator/cpcap-regulator.c
@@ -222,7 +222,7 @@ static unsigned int cpcap_map_mode(unsigned int mode)
case CPCAP_BIT_AUDIO_LOW_PWR:
return REGULATOR_MODE_STANDBY;
default:
- return -EINVAL;
+ return REGULATOR_MODE_INVALID;
}
}