diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-11-14 04:40:15 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-14 16:44:45 -0500 |
commit | abbb18fb4ad7472ee2e1351f0ca12bce64cac143 (patch) | |
tree | 6d978b25cf53daefb0003cd54d4f98bbc3e0c292 /drivers/base/regmap/regmap.c | |
parent | 58072cbfc522c2520e34333a53c8f17bb1adb1a0 (diff) |
regmap: return ERR_PTR instead of NULL in regmap_init
The regmap_init documentation states that it will either return a pointer to a
valid regmap structure or a ERR_PTR in case of an error. Currently it returns a
NULL pointer in case no bus or no config was given. Since NULL is not a
ERR_PTR a caller might assume that it is a pointer to a valid regmap structure,
so return a ERR_PTR(-EINVAL) instead.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r-- | drivers/base/regmap/regmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index b08df85cedff..b84ebf9eecf0 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -139,7 +139,7 @@ struct regmap *regmap_init(struct device *dev, | |||
139 | int ret = -EINVAL; | 139 | int ret = -EINVAL; |
140 | 140 | ||
141 | if (!bus || !config) | 141 | if (!bus || !config) |
142 | return NULL; | 142 | goto err; |
143 | 143 | ||
144 | map = kzalloc(sizeof(*map), GFP_KERNEL); | 144 | map = kzalloc(sizeof(*map), GFP_KERNEL); |
145 | if (map == NULL) { | 145 | if (map == NULL) { |