From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A728C388F7 for ; Tue, 3 Nov 2020 21:00:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B8D3223AC for ; Tue, 3 Nov 2020 21:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437246; bh=su3cQwyHx3kCHKDVHurH/fOB9rM7M9B3DeAEDRy13to=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rSiegJrdltF1cXsDET3P+eNpy5E4ZpS4P8C2d5eVS/oSBpompWyiG8caLBndTFW3V zXE0SwOx5yW8+1WgRJ6b/3//1JWs23zNw5is7pjbD7E2dwMinzY2/LxodtrLap8NPQ zVwoXFMLNMERp6f/G71MbeucqkCpsiITY1DQN+wQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733279AbgKCVAp (ORCPT ); Tue, 3 Nov 2020 16:00:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:36716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733267AbgKCVAl (ORCPT ); Tue, 3 Nov 2020 16:00:41 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEC0722226; Tue, 3 Nov 2020 21:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437241; bh=su3cQwyHx3kCHKDVHurH/fOB9rM7M9B3DeAEDRy13to=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fg1DdtX8BdBwGRz40htaavR+WEaaKlcRoK7w0VyuwyJ3pTtG5ZCQat0XOQPSK7ii9 LljRltDrdq9Mr/ZjjAcAt/oWMw/Rzv+BUGxGtzBLf+wqjqYwjMCdTVHZ4uIYNuqg0S cAO6gOeJZC3FoIhpuZ/EtmrzuOAPmHvd/nOtKOBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ferry Toth , Andy Shevchenko , Heikki Krogerus , "Rafael J. Wysocki" Subject: [PATCH 5.4 207/214] device property: Keep secondary firmware node secondary by type Date: Tue, 3 Nov 2020 21:37:35 +0100 Message-Id: <20201103203310.018855101@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit d5dcce0c414fcbfe4c2037b66ac69ea5f9b3f75c upstream. Behind primary and secondary we understand the type of the nodes which might define their ordering. However, if primary node gone, we can't maintain the ordering by definition of the linked list. Thus, by ordering secondary node becomes first in the list. But in this case the meaning of it is still secondary (or auxiliary). The type of the node is maintained by the secondary pointer in it: secondary pointer Meaning NULL or valid primary node ERR_PTR(-ENODEV) secondary node So, if by some reason we do the following sequence of calls set_primary_fwnode(dev, NULL); set_primary_fwnode(dev, primary); we should preserve secondary node. This concept is supported by the description of set_primary_fwnode() along with implementation of set_secondary_fwnode(). Hence, fix the commit c15e1bdda436 to follow this as well. Fixes: c15e1bdda436 ("device property: Fix the secondary firmware node handling in set_primary_fwnode()") Cc: Ferry Toth Signed-off-by: Andy Shevchenko Reviewed-by: Heikki Krogerus Tested-by: Ferry Toth Cc: 5.9+ # 5.9+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3414,7 +3414,7 @@ void set_primary_fwnode(struct device *d } else { if (fwnode_is_primary(fn)) { dev->fwnode = fn->secondary; - fn->secondary = NULL; + fn->secondary = ERR_PTR(-ENODEV); } else { dev->fwnode = NULL; }