From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA205C432C0 for ; Thu, 21 Nov 2019 02:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2AC62075A for ; Thu, 21 Nov 2019 02:40:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="QQGLgBNX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726701AbfKUCka (ORCPT ); Wed, 20 Nov 2019 21:40:30 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:48838 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbfKUCk2 (ORCPT ); Wed, 20 Nov 2019 21:40:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Y4wjRpQvsAPhU0ecdnz6Kh4okkQOALRAUnYIw6eZfqg=; b=QQGLgBNXJ2zuXQWXmGy6ADebxO Vpc+tAldP65ZncaFN9Brw9ADK6Yh+QNIrbfl/ukIl/g/8a7Wvpq74DVqBYlaVEZH3qLaudBZZ+IJh mi7valFbQMCPVTTZSJW0mBCup+bJxPzoUaHBJmtP8dpcvSx12xsTdofwNcMZ3HcVfGcQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iXbtP-000707-0F; Thu, 21 Nov 2019 03:08:23 +0100 Date: Thu, 21 Nov 2019 03:08:22 +0100 From: Andrew Lunn To: Geert Uytterhoeven , David Bauer Cc: Andy Shevchenko , Marek =?iso-8859-1?Q?Beh=FAn?= , Dmitry Torokhov , Florian Fainelli , David Bauer , "David S. Miller" , Sergei Shtylyov , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH net 1/1] mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled Message-ID: <20191121020822.GD18325@lunn.ch> References: <20191118181505.32298-1-marek.behun@nic.cz> <20191119102744.GD32742@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > The difference with the non-optional case is that > __devm_reset_control_get() registers a cleanup function if there's > no error condition, even for NULL (which is futile, will send a patch). > > However, more importantly, mdiobus_register_reset() calls a devm_*() > function on "&mdiodev->dev" ("mdio_bus ee700000.ethernet-ffffffff:01"), > which is a different device than the one being probed > (("ee700000.ethernet"), see also the callstack below). > In fact "&mdiodev->dev" hasn't been probed yet, leading to the WARNING > when it is probed later. > > [] (mdiobus_register_device) from [] (phy_device_register+0xc/0x74) > [] (phy_device_register) from [] (of_mdiobus_register_phy+0x144/0x17c) > [] (of_mdiobus_register_phy) from [] (of_mdiobus_register+0x1c4/0x2d0) > [] (of_mdiobus_register) from [] (sh_eth_drv_probe+0x778/0x8ac) > [] (sh_eth_drv_probe) from [] (platform_drv_probe+0x48/0x94) > > Has commit 71dd6c0dff51b5f1 ("net: phy: add support for > reset-controller") been tested with an actual reset present? > > Are Ethernet drivers not (no longer) allowed to register MDIO busses? That is not good. The devm_reset_control_get() call need replaces with an unmanaged version, and a call to reset_control_put() added to mdiobus_unregister_device(). David, could you look at this, it was a patch from you that added this. Andrew