regmap: align dev_get_regmap error return with Linux
Subsystems (4)
PATCH 1/1 regmap: align dev_get_regmap error return with Linux
dev_get_regmap returns NULL in Linux and not an error pointer as in barebox. Align the barebox return, so kernel code using it can be ported unmodified.
Reported-by Sohaib Mohamed <[email protected]>
Signed-off-by Ahmad Fatoum <[email protected]>
--- drivers/base/regmap/regmap.c | 4 ++-- drivers/regulator/stpmic1_regulator.c | 4 ++-- drivers/watchdog/rn5t568_wdt.c | 4 ++-- drivers/watchdog/stpmic1_wdt.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/base/regmap/regmap.c +2 -2
@@ -148,7 +148,7 @@ struct regmap *regmap_init(struct device *dev,* @dev: The device the maps is attached to * @name: Optional name for the map. If given it must match. * -* Returns a pointer to the regmap or a ERR_PTR value on failure +* Returns the regmap for the device if one is present, or NULL. */ struct regmap *dev_get_regmap (struct device *dev,const char *name) {
@@ -163,7 +163,7 @@ struct regmap *dev_get_regmap(struct device *dev, const char *name)return map; } -return ERR_PTR (-ENOENT ); +return NULL ; }struct device *regmap_get_device (struct regmap *map)
drivers/regulator/stpmic1_regulator.c +2 -2
@@ -401,8 +401,8 @@ static int stpmic1_regulator_register(struct device *dev, int id, cfg->rdev.desc = &cfg->desc; cfg->rdev.dev = dev; cfg->rdev.regmap =dev_get_regmap (dev->parent,NULL ); -if (IS_ERR (cfg->rdev.regmap)) -return PTR_ERR (cfg->rdev.regmap); +if (!cfg->rdev.regmap) +return -ENOENT ; ret =of_regulator_register (&cfg->rdev, match->of_node);if (ret) {
drivers/watchdog/rn5t568_wdt.c +2 -2
@@ -117,8 +117,8 @@ static int rn5t568_wdt_probe(struct device *dev) wdt =xzalloc (sizeof (*wdt)); wdt->regmap =dev_get_regmap (dev->parent,NULL ); -if (IS_ERR (wdt->regmap)) -return PTR_ERR (wdt->regmap); +if (!wdt->regmap) +return -ENOENT ; wdd = &wdt->wdd; wdd->hwdev = dev;
drivers/watchdog/stpmic1_wdt.c +2 -2
@@ -169,8 +169,8 @@ static int stpmic1_wdt_probe(struct device *dev) wdt =xzalloc (sizeof (*wdt)); wdt->regmap =dev_get_regmap (dev->parent,NULL ); -if (IS_ERR (wdt->regmap)) -return PTR_ERR (wdt->regmap); +if (!wdt->regmap) +return -ENOENT ; wdd = &wdt->wdd; wdd->hwdev = dev;
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 5 lines · Ahmad Fatoum
dev_get_regmapreturns NULL in Linux and not an error pointer as in barebox. Align the barebox return, so kernel code using it can be ported unmodified.
Applied, thanks!
[1/1] regmap: align dev_get_regmap error return with Linux
https://git.pengutronix.de/cgit/barebox/commit/?id=9873ebb62370 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>