Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4488747ivc; Tue, 3 Nov 2020 13:22:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJrV7z30Z6LzHEOzgHCxZ7KFFa6jVSgVIyzGz4od3iyTY7GtzJWUurhZvs3LjyDuK3547p X-Received: by 2002:a17:906:3553:: with SMTP id s19mr22775228eja.195.1604438562272; Tue, 03 Nov 2020 13:22:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438562; cv=none; d=google.com; s=arc-20160816; b=uErMtSYrAFFW8aELkO6PmqgRarg3L3hWhAyLoetcj+Nk2jWojBbISsNY4fa4XUinWd do4pexxjp5WfI2yxj6Ls0+YXXHGH3rayZ88/8y05eqGUT17hZy7hYs/Mjm7DkzpFFHUk 5wEOvdN/+Ov0Pq3t1mp5K6JwHwLFWKQjkFgCFRLE+Y8BqnJDpviJsTBTkpdBS8d1trLz hpkQnJudxQTf5/Acr/NLpdN11XXQNF2X3r5PSrTeMIFk03y3/hYmlZqdf5YCXZBJ5YWm dUQT5H2ZV1m8EMM2z9tiN1rnsxeyicwVcBnNFV0/LDmS3FNVkiYgrX+WUZUJGhB2hcrH GdzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8zvLoYkjwTm4ArXfU1oJoB51Lcy9t1FZzoBKgrKCdfI=; b=I/yppyH3clCBewHRsIIhNoZfS4c50kDJJGPqV4pR0cTPKPxb/DK/PWdYZTKcgX9IVa YSm5em/BWdzZRF4rJ2QCQ0QjoKUt3+zokM+N5BmmzIVVJygVYQ6fzEcHy+lxaeHwcYKf Oj/Kq/4VnMhxm3OR9xd9MRHErSapSG2r9IFPRX87uOhFHIVfzX6DShVmKV4Uy8wE0gLB /L43Ic6jUkORTzFif13N3CtvCcSR5indmeeYhaXCd3xIXYIIVMPkHyqrNAD50BfUs/+1 sRnMkvCdqCGEvTzHp3phUVOgTQKBXksA0UK0MXnERpCd7CzFaLKACOUtr1uA6Yt2rpqk W37Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NEcXx3U8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si13372389edq.0.2020.11.03.13.22.19; Tue, 03 Nov 2020 13:22:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NEcXx3U8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729780AbgKCVTo (ORCPT + 99 others); Tue, 3 Nov 2020 16:19:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:47626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388106AbgKCVIO (ORCPT ); Tue, 3 Nov 2020 16:08:14 -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 8A325206B5; Tue, 3 Nov 2020 21:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437694; bh=ItFgdjLKu8yOB12TxBxljHIKruFvvR9pBIfagHIw7zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEcXx3U8MUmgXBdVoeHz4dHOzHiCQzNuKvZqSIbQeTvY33rVRO6MdP9rhK9NIy1PL fkkCMAJL9pkHHyUvuZEfNoxqH2VS+jUm6srgrK7XtFon9faw3by92CbCO5CmZowLrV dG7KdtR6j7TGKR182iMPtsTIKiJwQoIxiQefLlVE= 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 4.19 186/191] device property: Keep secondary firmware node secondary by type Date: Tue, 3 Nov 2020 21:37:58 +0100 Message-Id: <20201103203250.193488355@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 @@ -3347,7 +3347,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; }