From patchwork Tue Aug 1 21:54:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 129517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp56304vqx; Tue, 1 Aug 2023 15:38:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlGN4guP6bpn0gpyKk8ZtRz2GyvvJDGE7kkooy3XqSJ6xl5N8V1k7ct6TcpG8ae2RsnGdkl6 X-Received: by 2002:a17:907:2cc1:b0:99b:ead0:2733 with SMTP id hg1-20020a1709072cc100b0099bead02733mr3254145ejc.72.1690929485008; Tue, 01 Aug 2023 15:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690929484; cv=none; d=google.com; s=arc-20160816; b=sSBRptUTojYkj8veTDhcFlnNKYNUpbxFr4YSwEJC5Aoz6tfK1JvZrhgjpd6mhD2yWS 6hZan0sq8Vkr2uyAS/Fl5z3I7cB9OXuZhDohsNLDy3nBGYqA8ogH/AKmqcjDfH82NQIZ /z46DnjEX/RoASfXhZzhkaPUAWMteLlq6B/iWoEP4DvZL37VLC2/9BIss5Au9uwclxuB zUAasfMxiYeyicZP9xQGeHKY/voyj9mYNvdj1Tdo04N3WQKxXk131SWntLRCH13SCWRX 6bCYzbpenFOKca7Le/YQpoEISqaXuw27yNvZtemAYBAxWmMbv7aesnE8J1paG8p5CWYX XksA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=wIzW6kt+Fnq1RKPjcOX+W8gThJdrKIQ/bO0JbL7uGCw=; fh=9muYjwzOjeujIiOiqgEm7G2SJDFzcm638Q1NXjJ2Sec=; b=AhCoszCXzzMbWuLUUuPfpKdkSpHs4GXV1qj8/YBcIPbq4lbo6ogFjs66JZ58lNv0O5 Lxw9VxUlyTSd1fukAYkdW06kYRSUE2+litxromvCe4hCf30g2Q45MSF4GYAJ/Pny+haK hdzoy+zJlOUeWZgF8ffc3J0Dh4SCBqIbsN3a52Zh4N4rrE2arfqn8BEll4ktc5iIfRzl rg4ZRATdAS8TXYOXzFKcpZ2An+IREs5zw1n8mrJQytqsqFbuvO/KOgpRT4VFyDiztYKo 3nZ6Sh0jPL8/xeLVJEqLadnocUk0eb+v5ukK7vjL95AZN16FgLxowswbeNun9IpKhYlZ yP0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AkuLzquP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a1709067c1300b00977e0bdac8asi5309545ejo.583.2023.08.01.15.37.40; Tue, 01 Aug 2023 15:38:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AkuLzquP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232779AbjHAVzg (ORCPT + 99 others); Tue, 1 Aug 2023 17:55:36 -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 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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773068075743539221 X-GMAIL-MSGID: 1773068075743539221 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; + /* If the property is in deadprops then it must be removed */ + for (next = &np->deadprops; *next; next = &(*next)->next) { + if (*next == prop) { + *next = prop->next; + break; + } + } + prop->next = NULL; next = &np->properties; while (*next) { @@ -1640,6 +1648,15 @@ int __of_update_property(struct device_node *np, struct property *newprop, { struct property **next, *oldprop; + /* If the property is in deadprops then it must be removed */ + for (next = &np->deadprops; *next; next = &(*next)->next) { + if (*next == newprop) { + *next = newprop->next; + newprop->next = NULL; + break; + } + } + for (next = &np->properties; *next; next = &(*next)->next) { if (of_prop_cmp((*next)->name, newprop->name) == 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_changeset_entry *ce, static int __of_changeset_entry_apply(struct of_changeset_entry *ce) { - struct property **propp; unsigned long flags; int ret = 0; @@ -581,15 +580,6 @@ static int __of_changeset_entry_apply(struct of_changeset_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 = &ce->np->deadprops; *propp; propp = &(*propp)->next) { - if (*propp == ce->prop) { - *propp = ce->prop->next; - ce->prop->next = NULL; - break; - } - } - ret = __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_changeset_entry *ce) break; case OF_RECONFIG_UPDATE_PROPERTY: - /* If the property is in deadprops then it must be removed */ - for (propp = &ce->np->deadprops; *propp; propp = &(*propp)->next) { - if (*propp == ce->prop) { - *propp = ce->prop->next; - ce->prop->next = NULL; - break; - } - } - ret = __of_update_property(ce->np, ce->prop, &ce->old_prop); break; default: