mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] regmap: align dev_get_regmap error return with Linux
@ 2026-03-23  7:24 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-03-23  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Sohaib Mohamed, Ahmad Fatoum

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 <sohaib.amhmd@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 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(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e27ba53dec58..e4b20c07809d 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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)
diff --git a/drivers/regulator/stpmic1_regulator.c b/drivers/regulator/stpmic1_regulator.c
index 3ed351b5801a..eade6046d603 100644
--- a/drivers/regulator/stpmic1_regulator.c
+++ b/drivers/regulator/stpmic1_regulator.c
@@ -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) {
diff --git a/drivers/watchdog/rn5t568_wdt.c b/drivers/watchdog/rn5t568_wdt.c
index 2011e3e01c5f..8c3e4175f9c0 100644
--- a/drivers/watchdog/rn5t568_wdt.c
+++ b/drivers/watchdog/rn5t568_wdt.c
@@ -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;
diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
index f25656e75c12..21cf721de790 100644
--- a/drivers/watchdog/stpmic1_wdt.c
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -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;
-- 
2.47.3




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-23  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-23  7:24 [PATCH] regmap: align dev_get_regmap error return with Linux Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox