Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp119626pxb; Tue, 24 Aug 2021 22:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYEstawoUCdHngQ4/H8uZdcxpLjJIejY/hioKHdkXmAAOUS7TpJjyEzbe+Dx9sZR27aBjc X-Received: by 2002:a05:6e02:531:: with SMTP id h17mr29503802ils.288.1629868074263; Tue, 24 Aug 2021 22:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629868074; cv=none; d=google.com; s=arc-20160816; b=N0UcQWW38Tl0g3o6+mwIWywsTOL8VjrvtXcHs+6/TJSJ0Oydlzu4vlKri6HYMGKe/p 2JUJXhgV83JoMsMD2EDRevaevRXIyaESpds10FSo4o4MQtbS1OcNWvKZZkW5+hVZ9Hs0 tCPO0gUsOUuipUQXbjXb+nIpzEHNksu81JYEtdmMgEaHJC32QTwdzA6D8OnkghYCjcMm hLd2ujxfQEqWcNh1BwruLVvJh+DKfBBxJE16i5uz5ay4Ocsv03e6IbmpsZ2jUyFX/gIP 4DZE1U96j/tWSLse2Uq+Xjd0ne8gxp2KTdGerOOcywgtVWI/tpp52zUsCRhltqb9igRV JCwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GXs8HTT1O4dXjEJz9+iLCgBhRp65IhQY05xCNWVtJKk=; b=MpGQGzPmp0R0zfjD+Zibq/fLSd/4wGYvwk+UjfXn6T86sQVJ7r2XZcOTORUv7A9rYt U3fTvs8NbQgEKMo0/cQWsyCORzKVVDkW3NpARBpWMVQ4RvmsVokmLrSlDdTFzuaiq8Cp RjR2L+7CZ9CU5dNxYtNzm7ZygN+Uo39x6JhjdVUC4Xx/VmYqxu/zxaBY9hTk1IZpKOLD Kopco1mHOXTfAsGTqL7QiB38usQ06taeVv/R3Yesw6uJCqW6SnEu1oFGBl0RA5s/ti35 jqtoc7v4tjvd5tYXKPtfJ3ZygJ+NDMW/vGt5HrRaXufQH729sY8o6ckRqs0hBS9iwE4j d7OQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si20641130ilo.33.2021.08.24.22.07.42; Tue, 24 Aug 2021 22:07:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231816AbhHYFGW (ORCPT + 99 others); Wed, 25 Aug 2021 01:06:22 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:36344 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230407AbhHYFGV (ORCPT ); Wed, 25 Aug 2021 01:06:21 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7DCF01C0B77; Wed, 25 Aug 2021 07:05:35 +0200 (CEST) Date: Wed, 25 Aug 2021 07:05:35 +0200 From: Pavel Machek To: Saravana Kannan Cc: Pavel Machek , Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andrew Lunn , Marc Zyngier , Kevin Hilman , "David S . Miller" Subject: Re: [PATCH 5.10 64/98] net: mdio-mux: Handle -EPROBE_DEFER correctly Message-ID: <20210825050535.GA24601@duo.ucw.cz> References: <20210824165908.709932-1-sashal@kernel.org> <20210824165908.709932-65-sashal@kernel.org> <20210824190009.GA16752@duo.ucw.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > When registering mdiobus children, if we get an -EPROBE_DEFER, we sho= uldn't > > > ignore it and continue registering the rest of the mdiobus children. = This > > > would permanently prevent the deferring child mdiobus from working in= stead > > > of reattempting it in the future. So, if a child mdiobus needs to be > > > reattempted in the future, defer the entire mdio-mux initialization. > > > > > > This fixes the issue where PHYs sitting under the mdio-mux aren't > > > initialized correctly if the PHY's interrupt controller is not yet re= ady > > > when the mdio-mux is being probed. Additional context in the link > > > below. > > > > I don't believe this is quite right. AFAICT it leaks memory in the > > EPROBE_DEFER case. Could someone double-check? Suggested fix is below. >=20 > devm_ APIs would take care of releasing the resource (memory) > automatically because the probe didn't succeed. So I'm not sure > there's a leak. Does that make sense? Yes, it does, I believe you are right. This part of code confused me: We are going to return error there, yet we do explicit tree, which should not be neccessary according to this logic. dev_err(dev, "Error: No acceptable child buses found\n"); devm_kfree(dev, pb); Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYSXPnwAKCRAw5/Bqldv6 8s8gAJ96e9g8EYddYS9zyNJcBRetQ5lJ7gCghzCQkr+EHZDoCkAdDdVCj0rH4mw= =Xidz -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn--