Commit 9f4629be authored by Simon Glass's avatar Simon Glass

dm: core: Add device checking to syscon_get_regmap()

This function can only handle a syscon device. It is possible that someone
will make a mistake, so add a check for this.

Also we should return -ENODEV when a device cannot be found, so update the
syscon_get_regmap_by_driver_data() to follow this convention.
Signed-off-by: default avatarSimon Glass <>
parent 85aeda4a
......@@ -17,8 +17,11 @@
struct regmap *syscon_get_regmap(struct udevice *dev)
struct syscon_uc_info *priv = dev_get_uclass_priv(dev);
struct syscon_uc_info *priv;
if (device_get_uclass_id(dev) != UCLASS_SYSCON)
priv = dev_get_uclass_priv(dev);
return priv->regmap;
......@@ -52,7 +55,7 @@ struct regmap *syscon_get_regmap_by_driver_data(ulong driver_data)
return ERR_PTR(-ENOENT);
return ERR_PTR(-ENODEV);
void *syscon_get_first_range(ulong driver_data)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment