diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c3d1c19b79bf..1e6089cf9625 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1800,6 +1800,12 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) } } + if (r == rdev) { + dev_err(dev, "Supply for %s (%s) resolved to itself\n", + rdev->desc->name, rdev->supply_name); + return -EINVAL; + } + /* * If the supply's parent device is not the same as the * regulator's parent device, then ensure the parent device