Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527709pxf; Mon, 15 Mar 2021 11:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpds5Vtkg+wnI+Jx1hi0rMbo0YYYcqg5OzyEicAUUJroTJT0UxQYtJEaWgctcw10SUcucn X-Received: by 2002:aa7:c4cc:: with SMTP id p12mr30779211edr.325.1615833180884; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833180; cv=none; d=google.com; s=arc-20160816; b=UK/VOf33OAO/ZPB5M6ha0UxIGFXhNMvf9yL9TDlie+MP3ezLt4ErNqcoJxAqUUtC8w /MVH660YqI/PfnNewGrhdWRDUW2ADj+5pwE1GLfRnvqFGdO6g/O83cOkUCm1k4I6SZOv pXmKkv3KSZraxXdNN2bYRZMMSnU9xxf79y22E0WceeeQuJdrHhetSyTEBrQHOSnfVYtr +zbAEhNpL6dhSRHAUym0qoigwOLl3ywYK13BSH3oUn2Vsrs7TsZcPG49lCp/0O2ZDs8f 14uLqwo/wqjM9P5uV7QELlOA/x9sG8fKVcCNmcILH4QuseJXKiL+EZEBMqjki9ek4IjQ 0cFQ== 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=9G0bvtNTyRZY06vlOtBNOo7DWkcWS1TDPRrBwW7qOjQ=; b=Mx7DhQis7CkPRYo6RjH6fCjIU9KxtmpvLFvfznNSXiDgiK9k9fkg+kXcBDqYVTEBSt eUJu1PhVgOht1OgPEvGP70HiyVKaPgQUoAYuHq9DlsanwD5pEOG/iAxGW/HYUXf896Bi eLqQZsHpeVdExZ4ZJTUCeAWdZ8oISsfsYlAWYgWe23a2KZ6kDTkjkUCAN2m+oIAfEgjH 9Vu6DU0cjfjxnaHASCb5D++ZAgsJTiaICljfgCvvr+bZ+kcr8yyr2ctF1+7MFruMiIYC AykI4QE341A4QvevexZbzipx7iIPK16y8TL0jzQEy/3pHStyGvWECBgLLutsMVT0NbYS q9Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1EfL+ll/"; 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 cw19si11292866edb.211.2021.03.15.11.32.38; Mon, 15 Mar 2021 11:33:00 -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="1EfL+ll/"; 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 S233373AbhCOOij (ORCPT + 99 others); Mon, 15 Mar 2021 10:38:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:48770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233659AbhCOOCR (ORCPT ); Mon, 15 Mar 2021 10:02:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14E0E64EF8; Mon, 15 Mar 2021 14:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816926; bh=xcBrq3kDGzZjHnI73Sxcu29nEqrkieYemkYWm+6nhbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1EfL+ll/5ahKNngzfsNVQRr744AnlqslgcGLwhiVtocz4tKzoPihCAa3wIElXJWlO IspjM95dHht7dVuwb0rKeg0OvIeuZMgWFlC5qpr85HJshyycMHkHKxEfecX9Ifkvfq KDjx/g116jJrSy+sPcH8RDmL9wFWgNp0yNWB58r4= 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.10 191/290] software node: Fix node registration Date: Mon, 15 Mar 2021 14:54:44 +0100 Message-Id: <20210315135548.372685734@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -786,6 +786,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);