Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3526792pxf; Mon, 15 Mar 2021 11:31:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCzVtzCMeaoVUAvzhhn2idftx2P8f0JzGuPol4823qfIEUkHb+ta7vrV4ElNaNeB5aBJ2I X-Received: by 2002:a05:6402:1517:: with SMTP id f23mr32262112edw.272.1615833107865; Mon, 15 Mar 2021 11:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833107; cv=none; d=google.com; s=arc-20160816; b=K6d097lOjVb/2OWX2LWJFxhU2MFN1IDDfZb+bIbMYm/PsKSuAM1rL8zSQLKj3jvDaU uqd/i5Q9dRGXwfkjTCtPpV/joA0Jvu+rDdIem6H+1kv6ea6xM57X6SHa0xaKlMPzOM93 bMrvEkha9X3WecM13K54+BpKMgfs7q8EJDOFVfQrjaXjNstLiatOIaS4MytnMaJXaa6L E8LsXsEYag92jGYYjn3Pp+J962RVq2hS7e9XQRZ4v49EUbTzZbAi8HSVTD3F3uK1B7Zv ygomQjYFmOj6AOTC8YkQ4eI59L/XR67acvs6j+kNpVr6iehAEwaY2pRH89tkmKdpueWE BOcQ== 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=glAymg+BMXfb6TUi4zm/Vofm84Qb97EZu1ZF1x2xoVORCC5D/mk374tBAvxFwnSj2i IG47SFOynJlYrZyo+liAFTb7jUQPcsYPMpZjT72WhikMK6/ZmYjCUseDw494IteoMQNN XlTkuGGzW+s7XrtrUZGPNwsYQWp7ES84xaxF/mtGp6RBVMGBgzj6YOyRZTL1dsLc14WQ Ftzwxn2zxrkJLtlGEag/kzwkXXmi9EdQamu3P3SZuypLv8/JOzeHc8p1WjhRc8KxxUGY VwrcPOERb9scIOF4IuKn2EMwixGwa6sO+DbuYEjRfzfMg8/rjDvz9HdmuiIyPMW3uRTr XBcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rnSWnOtt; 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 4si12699616edc.257.2021.03.15.11.31.25; Mon, 15 Mar 2021 11:31:47 -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=rnSWnOtt; 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 S236507AbhCOOfs (ORCPT + 99 others); Mon, 15 Mar 2021 10:35:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:38284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233453AbhCOOBm (ORCPT ); Mon, 15 Mar 2021 10:01:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0631364F0B; Mon, 15 Mar 2021 14:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816891; bh=xcBrq3kDGzZjHnI73Sxcu29nEqrkieYemkYWm+6nhbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rnSWnOttZyaUMi0ogGozT6th6/aKioJfelGQ75hXUDxWfWkMOOaPWbZOWt+AASvo/ /jawX+MXbGDIVBElGbxdhFVAXLDpTPtrK/SGZr2wiW0T1H8VXA4CTJvqHR9+412CKK v0SYJUBnMym4BKxREUQvTsd3YPRFWjs/Yx3zx/hM= 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.11 185/306] software node: Fix node registration Date: Mon, 15 Mar 2021 14:54:08 +0100 Message-Id: <20210315135513.870106728@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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);