From cce125aae74e7c86a9f29d0dcc88ebb914c3d9c5 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Sat, 19 Mar 2022 15:38:07 +0800 Subject: [PATCH] regulator/rpmsg: list delete should use safe version in loop Signed-off-by: chao.an --- drivers/power/regulator_rpmsg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/power/regulator_rpmsg.c b/drivers/power/regulator_rpmsg.c index d9b450287d..77e86f40b0 100644 --- a/drivers/power/regulator_rpmsg.c +++ b/drivers/power/regulator_rpmsg.c @@ -327,9 +327,10 @@ static void regulator_rpmsg_server_unbind(FAR struct rpmsg_endpoint *ept) { FAR struct regulator_rpmsg_server_s *priv = ept->priv; FAR struct regulator_rpmsg_s *reg; + FAR struct regulator_rpmsg_s *tmp; - list_for_every_entry(&priv->regulator_list, reg, - struct regulator_rpmsg_s, node) + list_for_every_entry_safe(&priv->regulator_list, reg, tmp, + struct regulator_rpmsg_s, node) { while (regulator_is_enabled(reg->regulator)) {