Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp294480rdb; Thu, 1 Feb 2024 08:41:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTmVovlzGZ4kGtWjN3QL/kTSNKcwW/dPW4Ce0PRo8HaJVX5lKk8vmcD8+pHv+23OKW0q/D X-Received: by 2002:a17:906:19d0:b0:a35:d8ce:196a with SMTP id h16-20020a17090619d000b00a35d8ce196amr4116069ejd.24.1706805670876; Thu, 01 Feb 2024 08:41:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706805670; cv=pass; d=google.com; s=arc-20160816; b=ZUBuT27Wb/fptfDTUQ8xh4nrp86+SmdHvVMogqF+z7gIimXo9SQwSj0j1RTbG192N+ iO2/LeAiKYLByUSmqPsboDSYj7upB6fMmShEKyRwIsBiGdI0bRsxlfHPKZgXVZ2p0KXm bzczHGBMw8ppTiYafwaZhrOtNf5/0AOjhh+jJhoL8Lb7I1kbB8aMG54hyKCXu97K1sTp rqn/FKwYHCngGmPQSprYkefOt99SOLJfZ0yOcD76WCjhWud5vPJ7U98MVkm9UgMqhezM ksMtem6zPevR8MDoIXO8yOduJm2ng7Bpne3zl6m5im+0oFF4xyZy0eJ9lP4XoiognPUW iFxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:to:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=fLwj/enAe/83+wrgpQuzzWkloGf+d2t2aSnRG8cvdg0=; fh=vU9hsx8ZfTgH6ppio+ANni2SMisA0sj5mpit2yToA6E=; b=Gshhfu9p6jJEHoUfgrGtq3mnz2AegrmSOz5pbIXjNqyu5f5zG1ySG0EqMJEmJ+tQyK 77f+Hl5RnfTna+Qy6xghXxa8qCayLxh5ULRjQlttok9xnyrPMh3eGoOO1QqrQI0RpAwD 8xLSxqdE9bbFXTT4SLIgYiMtMjqKHiMwrGUfy/SXA2JwvS1X8dZd0CPKr25Nxh/5j2Xd tK6TwNLql2/Bl4autGqWgOgXCMHqbn89RUiOGg7utqdQu2sVI/v40RKM/qlqyi++CFPA BeJNj1V8sRRH3GOkZ3EPOrP9DGVMILfQFwotI0Lhd+YkQ3up3X1EbXY24KAOgmvuW9v6 AG4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmDmAyJI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXO7un3ceyeSVYDx/RfXG57/yH5MYYvrFFDb3fGLGsDg6IurHDodM3IWPBAfhS2uW9lXBULLvbk2K6QvsONM0gAFB4kFOcO84UL+EkM8Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t13-20020a170906064d00b00a3173b881aasi6802403ejb.4.2024.02.01.08.41.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:41:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmDmAyJI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9E3BE1F2668C for ; Thu, 1 Feb 2024 16:41:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54BE77E105; Thu, 1 Feb 2024 16:40:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NmDmAyJI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AC602C1B0; Thu, 1 Feb 2024 16:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805632; cv=none; b=Lrd/tqcl1YU6YSi8XmcZayBaT/jd2R5JAnNAsaOr3gfv6kGvJANd1YVigxXj32TIuQsUPgQNMRW7ljWDfw1AoQ9Z+91P7S/HXfBGVvhdgx8bBV+GxGLZzD/Z9n7O9ZdnzjCw/1j8oJ9XHrIwgC9jLqka3y7QyIOE9XE78UQQgTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805632; c=relaxed/simple; bh=1uDUyfxjxc7ZnmKbXWn7c4080mDYIoyCn8OIHNE86Do=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:To: Date:Message-ID; b=FEqCGEJvNSw0NNGlMeIcdXzPLOB/maz88Ek1WNy0epXkjPT377ow4E+ZZQmasS4FecuY7pxy8CZMKO7gHvL85MCWx0RqUGhE1TYWy3qEsUXLbFsX7rfviqaE1Dvoj4xZe4I/4emXFEMR938oOoyn1gaXCuqA/+ggR1Eh3qgwlbQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NmDmAyJI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED34AC433F1; Thu, 1 Feb 2024 16:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706805631; bh=1uDUyfxjxc7ZnmKbXWn7c4080mDYIoyCn8OIHNE86Do=; h=In-Reply-To:References:Subject:From:To:Date:From; b=NmDmAyJI7oXl7gcgFhi3lr6+03TWmLAbJZU+wUiXVk4W1c71yCNK9V/PbFOCkhEYu WzgxZwkrQkpyZzkyOewO7UnApEN2OsJCki760LTK1zhDCoW0vWtzkvcKaoQBEbLi3R 5Q+XvnIpY3EibKFsBlqxXAXLdi7UDkPsh+Zzw2W7pO/cRKDBeQvw5jJ5P+Unjdej6a XgMLVAqcVTD699HdwsVBim0W9vLZMDGo55Gmwv65lXGsUWhIRFqdJlxoFfifGkGWiP gHiSosa7R+ENx6DDudg6ECj4B75PMg5UTC8VGAsH7GARMh0TBejZdT532Gw+PxVmTl hjwN0vK7sytDA== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240201151747.7524-4-ansuelsmth@gmail.com> References: <20240201151747.7524-1-ansuelsmth@gmail.com> <20240201151747.7524-4-ansuelsmth@gmail.com> Subject: Re: [net-next PATCH v5 3/9] net: phy: add devm/of_phy_package_join helper From: Antoine Tenart To: Andrew Lunn , Bjorn Andersson , Christian Marangi , Conor Dooley , David S. Miller , Eric Dumazet , Frank Rowand , Heiner Kallweit , Jakub Kicinski , Konrad Dybcio , Krzysztof Kozlowski , Paolo Abeni , Rob Herring , Robert Marko , Russell King , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Date: Thu, 01 Feb 2024 17:40:28 +0100 Message-ID: <170680562826.4979.15332968112575820833@kwain> Quoting Christian Marangi (2024-02-01 16:17:29) > +/** > + * of_phy_package_join - join a common PHY group in PHY package > + * @phydev: target phy_device struct > + * @priv_size: if non-zero allocate this amount of bytes for private data > + * > + * This is a variant of phy_package_join for PHY package defined in DT. > + * > + * The parent node of the @phydev is checked as a valid PHY package node > + * structure (by matching the node name "ethernet-phy-package") and the > + * base_addr for the PHY package is passed to phy_package_join. > + * > + * With this configuration the shared struct will also have the np value > + * filled to use additional DT defined properties in PHY specific > + * probe_once and config_init_once PHY package OPs. > + * > + * Returns < 1 on error, 0 on success. Esp. calling phy_package_join() So, < 0 on error ? > +int of_phy_package_join(struct phy_device *phydev, size_t priv_size) > +{ > + struct device_node *node =3D phydev->mdio.dev.of_node; > + struct device_node *package_node; > + u32 base_addr; > + int ret; > + > + if (!node) > + return -EINVAL; > + > + package_node =3D of_get_parent(node); Is the node put on package leave? > + if (!package_node) > + return -EINVAL; > + > + if (!of_node_name_eq(package_node, "ethernet-phy-package") of_put_node? + below. > + return -EINVAL; > + > + if (of_property_read_u32(package_node, "reg", &base_addr)) > + return -EINVAL; > + > + ret =3D phy_package_join(phydev, base_addr, priv_size); > + if (ret) > + return ret; > + > + phydev->shared->np =3D package_node; Just looked quickly, looks like ->np is uninitialized in the !of join case. > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(of_phy_package_join);