From nobody Thu Sep 11 10:22:29 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FF58C0015E for ; Tue, 1 Aug 2023 21:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232782AbjHAVzh (ORCPT ); Tue, 1 Aug 2023 17:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbjHAVz0 (ORCPT ); Tue, 1 Aug 2023 17:55:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A31268C; Tue, 1 Aug 2023 14:55:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1FF1A61717; Tue, 1 Aug 2023 21:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB8C2C433C8; Tue, 1 Aug 2023 21:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690926923; bh=j035GzdMWI78hJ6xt3QYyUQ7BSA2USCCzXpQCLzuaQQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AkuLzquPcKwKmyHz45oa81zSrNbECRKfvP510Ls5d6u95yQthyCw0+nJy4U+HnG0Q fx4TMGZSuMERk+kjrqYF3AxEmrFYD+znh+S6J0TkhfV8VE94pMCL7Lj0XQ5CHQckiB h4s0pjmx9Z/45Ui3QnKUrMG5l+BQSWLlO3AoPaXrjEmOEfavHiDxcOSdNAQ8vmL+3C WtLkbtWnJkErhCS6x/Z6PijlJQxJ58892rEB7EbA3RA8DocX022M31CUTHSjea5xhm /7h6N3w2M+EBg8Y/idCmfZ6wHQPyH+bqq4RVfyVhnUGvYi6MM41RfbURq5SoQxNg4v RrM+bIpWqdQig== Received: (nullmailer pid 2469343 invoked by uid 1000); Tue, 01 Aug 2023 21:55:14 -0000 From: Rob Herring Date: Tue, 01 Aug 2023 15:54:47 -0600 Subject: [PATCH 4/5] of: dynamic: Move dead property list check into property add/update functions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230801-dt-changeset-fixes-v1-4-b5203e3fc22f@kernel.org> References: <20230801-dt-changeset-fixes-v1-0-b5203e3fc22f@kernel.org> In-Reply-To: <20230801-dt-changeset-fixes-v1-0-b5203e3fc22f@kernel.org> To: Frank Rowand , "Enrico Weigelt, metux IT consult" , "Rafael J. Wysocki" , Sakari Ailus , Petr Mladek , Andy Shevchenko , Geert Uytterhoeven Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.13-dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The changeset code checks for a property in the deadprops list when adding/updating a property, but of_add_property() and of_update_property() do not. As the users of these functions are pretty simple, they have not hit this scenario or else the property lists would get corrupted. Signed-off-by: Rob Herring --- drivers/of/base.c | 17 +++++++++++++++++ drivers/of/dynamic.c | 19 ------------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 166fb7d75337..99c07f3cbf10 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1538,6 +1538,14 @@ int __of_add_property(struct device_node *np, struct= property *prop) { struct property **next; =20 + /* If the property is in deadprops then it must be removed */ + for (next =3D &np->deadprops; *next; next =3D &(*next)->next) { + if (*next =3D=3D prop) { + *next =3D prop->next; + break; + } + } + prop->next =3D NULL; next =3D &np->properties; while (*next) { @@ -1640,6 +1648,15 @@ int __of_update_property(struct device_node *np, str= uct property *newprop, { struct property **next, *oldprop; =20 + /* If the property is in deadprops then it must be removed */ + for (next =3D &np->deadprops; *next; next =3D &(*next)->next) { + if (*next =3D=3D newprop) { + *next =3D newprop->next; + newprop->next =3D NULL; + break; + } + } + for (next =3D &np->properties; *next; next =3D &(*next)->next) { if (of_prop_cmp((*next)->name, newprop->name) =3D=3D 0) break; diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 31603b5a4ffc..4fd3699691b6 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -565,7 +565,6 @@ static int __of_changeset_entry_notify(struct of_change= set_entry *ce, =20 static int __of_changeset_entry_apply(struct of_changeset_entry *ce) { - struct property **propp; unsigned long flags; int ret =3D 0; =20 @@ -581,15 +580,6 @@ static int __of_changeset_entry_apply(struct of_change= set_entry *ce) __of_detach_node(ce->np); break; case OF_RECONFIG_ADD_PROPERTY: - /* If the property is in deadprops then it must be removed */ - for (propp =3D &ce->np->deadprops; *propp; propp =3D &(*propp)->next) { - if (*propp =3D=3D ce->prop) { - *propp =3D ce->prop->next; - ce->prop->next =3D NULL; - break; - } - } - ret =3D __of_add_property(ce->np, ce->prop); break; case OF_RECONFIG_REMOVE_PROPERTY: @@ -597,15 +587,6 @@ static int __of_changeset_entry_apply(struct of_change= set_entry *ce) break; =20 case OF_RECONFIG_UPDATE_PROPERTY: - /* If the property is in deadprops then it must be removed */ - for (propp =3D &ce->np->deadprops; *propp; propp =3D &(*propp)->next) { - if (*propp =3D=3D ce->prop) { - *propp =3D ce->prop->next; - ce->prop->next =3D NULL; - break; - } - } - ret =3D __of_update_property(ce->np, ce->prop, &ce->old_prop); break; default: --=20 2.40.1