Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3519820pxf; Mon, 15 Mar 2021 11:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXqQUS4dfm5kOhmkUsXp2+F4vggVMaZ1sbTP/nAP33ylAxfLUnL07isebsV9fUFHkXkbxJ X-Received: by 2002:aa7:cb90:: with SMTP id r16mr32099704edt.139.1615832522318; Mon, 15 Mar 2021 11:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832522; cv=none; d=google.com; s=arc-20160816; b=wEK7ruwYfCViIkuB0t+ph/2P/4oiR6uMULbbQuJM3MtxiA7yFvT2BRSLWTixIO4CDT YoQtKqadUABknQQXw2d7L7zShvVeSbdJIU1ztvEgFaC9THYC+Xh78VEPed2Vxiv9F/H6 2kHvTw9X/O/sZ0TRD1nE5BmByMyyumCclCu5t+nRrKOtnonIb8J1gOzWgU0EyxB6NvTW hQmwDHh1iHUb2nihA+f7jT0XivMlYhNQ1Mz9WECL8lF2ExI6mwUbl4wL64plNMm79co6 HRLFnV7wvkuBbd9iE1+D4bMUOnZf5AItTQ27NYbGnKqzaF5nXd4K2Vq54XX0KxhymsLS L99A== 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=DiTqdPXnsoH5JYGtRQEXee1r8MS4AI8t5K2ZlhKECKw=; b=gEkz37XTTWCqJt0i0brIWS85BapRujkg4noyzZDxdoTx7bMnBg3e8p5Heg/smvvqS9 8JrYf8n1pXZFBj436zirE4pcIiLhRVOGfaftWeu2tvLV9vpT8GnQlClNPpOhCVStfstz cap9VGF5HYL8rD10ZnBHCp1Gbl9rmt56G7fQX477KPZZd/x7/IYxj5CRWxmdhXQp2vTT SYNt+0gNj7jaZecYfmgmx6ZJI5eVzpIVg5x++seoh64ImmNlSWmb9mKm7sUARG4bgJxE uszFFbVWLjV3G2or4XDogw83l4z81v9stZp0PGMaCTrqa+pdq/ZErt6pVOqgBNLOUt3m p23A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bXJPH1ds; 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=pass (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 qt26si11436788ejb.216.2021.03.15.11.21.39; Mon, 15 Mar 2021 11:22:02 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=bXJPH1ds; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbhCOOUv (ORCPT + 99 others); Mon, 15 Mar 2021 10:20:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232628AbhCON7w (ORCPT ); Mon, 15 Mar 2021 09:59:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3943364EFC; Mon, 15 Mar 2021 13:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816774; bh=20NaSGLvTYKwMt1yutcaUGuc6VgU+tHjTLCYqQx3qRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXJPH1dspsrUZH/5zl+LY3f03xS+6YFaZ8DH1Yl6RapSNPtCtcR4bDRjVkIeAmcYf 6lS9IezBIrTs7bHDol/MMDTmP59N4kl4sQo5r+NmxK55qaEMgKu5zE/uW5wkilPekS 4jNVoLVNqAdBFOMJQllbelMbU8VbRZw4Vb8+OUA4= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Andy Shevchenko , "Rafael J. Wysocki" Subject: [PATCH 5.4 100/168] software node: Fix node registration Date: Mon, 15 Mar 2021 14:55:32 +0100 Message-Id: <20210315135553.655781092@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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: Greg Kroah-Hartman From: Heikki Krogerus commit 8891123f9cbb9c1ee531e5a87fa116f0af685c48 upstream. Software node can not be registered before its parent. Fixes: 80488a6b1d3c ("software node: Add support for static node descriptors") Cc: 5.10+ # 5.10+ Signed-off-by: Heikki Krogerus Reviewed-by: Andy Shevchenko Tested-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/base/swnode.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -812,6 +812,9 @@ int software_node_register(const struct if (software_node_to_swnode(node)) return -EEXIST; + if (node->parent && !parent) + return -EINVAL; + return PTR_ERR_OR_ZERO(swnode_register(node, parent, 0)); } EXPORT_SYMBOL_GPL(software_node_register);