mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
sysreset: syscon: Don't assume default value for offset and mask property
Per the DT binding, <offset> is a required property. Let's abort the probe if it is missing. For the <mask> property, current codes assume a default value of zero, which is not correct either. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
This commit is contained in:
@@ -41,6 +41,7 @@ static struct sysreset_ops syscon_reboot_ops = {
|
|||||||
int syscon_reboot_probe(struct udevice *dev)
|
int syscon_reboot_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct syscon_reboot_priv *priv = dev_get_priv(dev);
|
struct syscon_reboot_priv *priv = dev_get_priv(dev);
|
||||||
|
int err;
|
||||||
|
|
||||||
priv->regmap = syscon_regmap_lookup_by_phandle(dev, "regmap");
|
priv->regmap = syscon_regmap_lookup_by_phandle(dev, "regmap");
|
||||||
if (IS_ERR(priv->regmap)) {
|
if (IS_ERR(priv->regmap)) {
|
||||||
@@ -48,8 +49,17 @@ int syscon_reboot_probe(struct udevice *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->offset = dev_read_u32_default(dev, "offset", 0);
|
err = dev_read_u32(dev, "offset", &priv->offset);
|
||||||
priv->mask = dev_read_u32_default(dev, "mask", 0);
|
if (err) {
|
||||||
|
pr_err("unable to find offset\n");
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = dev_read_u32(dev, "mask", &priv->mask);
|
||||||
|
if (err) {
|
||||||
|
pr_err("unable to find mask\n");
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user