diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-11-14 10:40:15 +0100 |
---|---|---|
committer | Lokesh Pathak <lpathak@nvidia.com> | 2012-03-05 07:49:39 -0800 |
commit | b7a44ba03dbb7e251019dc578590f8c5080eae49 (patch) | |
tree | cc9dd655bba6fe7029fa7b7f10e47c71dd8f757d | |
parent | 2769ec26e0419872901e5784bc0a2e1890661714 (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>
(cherry picked from commit abbb18fb4ad7472ee2e1351f0ca12bce64cac143)
Change-Id: I4c853a8b5c70513f04ea5b338197c7416721ee12
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/87554
-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 7f0930d0fa5c..6529134b8ecc 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -139,7 +139,7 @@ struct regmap *regmap_init(struct device *dev, int ret = -EINVAL; if (!bus || !config) - return NULL; + goto err; map = kzalloc(sizeof(*map), GFP_KERNEL); if (map == NULL) { |