Skip to content

Commit

Permalink
regmap: return ERR_PTR instead of NULL in regmap_init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 14, 2011
1 parent 58072cb commit abbb18f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit abbb18f

Please sign in to comment.