Re: [RFC PATCH v3 1/5] of: dynamic: Add of_changeset_update_prop_string

From: Doug Anderson
Date: Fri Dec 01 2023 - 19:56:34 EST


Hi,

On Tue, Nov 28, 2023 at 12:45 AM Chen-Yu Tsai <wenst@xxxxxxxxxxxx> wrote:
>
> @@ -1039,3 +1039,50 @@ int of_changeset_add_prop_u32_array(struct of_changeset *ocs,
> return ret;
> }
> EXPORT_SYMBOL_GPL(of_changeset_add_prop_u32_array);
> +
> +static int of_changeset_update_prop_helper(struct of_changeset *ocs,
> + struct device_node *np,
> + const struct property *pp)
> +{
> + struct property *new_pp;
> + int ret;
> +
> + new_pp = __of_prop_dup(pp, GFP_KERNEL);
> + if (!new_pp)
> + return -ENOMEM;
> +
> + ret = of_changeset_update_property(ocs, np, new_pp);
> + if (ret) {
> + kfree(new_pp->name);
> + kfree(new_pp->value);
> + kfree(new_pp);

Given that this is the 3rd copy of the freeing logic, does it make
sense to make __of_prop_free() that's documented to free what was
returned by __of_prop_dupe()?