regulator:check id conflict when register

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
dulibo1 2023-08-21 16:40:23 +08:00 committed by Xiang Xiao
parent 57d9083844
commit 127bd81674

View File

@ -964,6 +964,12 @@ regulator_register(FAR const struct regulator_desc_s *regulator_desc,
return NULL;
}
if (regulator_dev_lookup(regulator_desc->name))
{
pwrerr("regulator name is registered\n");
return NULL;
}
if (regulator_ops->get_voltage && regulator_ops->get_voltage_sel)
{
pwrerr("get_voltage and get_voltage_sel are both assigned\n");