diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e225711bb8bc0009114d6ec0d95ab8d2bb2d68f3..4bc5ea9721c22c643e9c641b016bc2aa8cbc1ae8 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3585,7 +3585,7 @@ regulator_register(const struct regulator_desc *regulator_desc, { const struct regulation_constraints *constraints = NULL; const struct regulator_init_data *init_data; - static atomic_t regulator_no = ATOMIC_INIT(0); + static atomic_t regulator_no = ATOMIC_INIT(-1); struct regulator_dev *rdev; struct device *dev; int ret, i; @@ -3658,8 +3658,8 @@ regulator_register(const struct regulator_desc *regulator_desc, /* register with sysfs */ rdev->dev.class = ®ulator_class; rdev->dev.parent = dev; - dev_set_name(&rdev->dev, "regulator.%d", - atomic_inc_return(®ulator_no) - 1); + dev_set_name(&rdev->dev, "regulator.%lu", + atomic_inc_return(®ulator_no)); ret = device_register(&rdev->dev); if (ret != 0) { put_device(&rdev->dev);