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.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 71D89C35646 for ; Fri, 21 Feb 2020 11:53:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4909924650 for ; Fri, 21 Feb 2020 11:53:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="ahBR5381" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbgBULxI (ORCPT ); Fri, 21 Feb 2020 06:53:08 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:47810 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbgBULxI (ORCPT ); Fri, 21 Feb 2020 06:53:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: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=Y7RbabUMIDfHWd7Ngw4xz5H4W9/l5MseELv5WZtFTE0=; b=ahBR5381IZD9MUKbH2u1z1WLC KL5VezEwjBFD4BdxEJuOcvM2Uzlr7WUVzm1Zon4Zi4oOSzk9IEOipABaycY28AmAn0b+MbkrNT1tt 30JKFO/P/E1DbXZlnDobJuqLzEJGYPhiwXmNqM1lpYtAvad6nJxHWTkgLxG3w1bYXakOie9v1OpYy t1FhKZX0rVOKhRZnSRlC/5RydWxIi7iwGpikJpElXjEC8lTdoL9IfukeZ7x7Isz6IlffpC9nxhHrs P1NcVdaN0Wfz1TPM1RJigTHfn9N5EsnwMXtKYqYiC7INe8OWJD+Va3SFaq5n2RfjPKM/+6as7+ECk K7J4JFjlA==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:50816) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1j56rU-00011f-Lm; Fri, 21 Feb 2020 11:52:52 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1j56rQ-0003Tj-P3; Fri, 21 Feb 2020 11:52:48 +0000 Date: Fri, 21 Feb 2020 11:52:48 +0000 From: Russell King - ARM Linux admin To: ansuelsmth@gmail.com Cc: 'Andy Gross' , 'Bjorn Andersson' , "'David S. Miller'" , 'Rob Herring' , 'Mark Rutland' , 'Andrew Lunn' , 'Florian Fainelli' , 'Heiner Kallweit' , linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: R: [PATCH v3 1/2] net: mdio: add ipq8064 mdio driver Message-ID: <20200221115248.GH25745@shell.armlinux.org.uk> References: <20200220232624.7001-1-ansuelsmth@gmail.com> <20200221004013.GF25745@shell.armlinux.org.uk> <000601d5e850$c0161cc0$40425640$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000601d5e850$c0161cc0$40425640$@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, Feb 21, 2020 at 01:49:17AM +0100, ansuelsmth@gmail.com wrote: > > On Fri, Feb 21, 2020 at 12:26:21AM +0100, Ansuel Smith wrote: > > > +static int > > > +ipq8064_mdio_probe(struct platform_device *pdev) > > > +{ > > > + struct device_node *np = pdev->dev.of_node; > > > + struct ipq8064_mdio *priv; > > > + struct mii_bus *bus; > > > + int ret; > > > + > > > + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv)); > > > + if (!bus) > > > + return -ENOMEM; > > > + > > > + bus->name = "ipq8064_mdio_bus"; > > > + bus->read = ipq8064_mdio_read; > > > + bus->write = ipq8064_mdio_write; > > > + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev- > > >dev)); > > > + bus->parent = &pdev->dev; > > > + > > > + priv = bus->priv; > > > + priv->base = syscon_node_to_regmap(np); > > > + if (IS_ERR_OR_NULL(priv->base)) { > > > + priv->base = syscon_regmap_lookup_by_phandle(np, > > "master"); > > > + if (IS_ERR_OR_NULL(priv->base)) { > > > + dev_err(&pdev->dev, "master phandle not > > found\n"); > > > + return -EINVAL; > > > + } > > > + } > > > > I'm curious why you've kept this as-is given my comments? > > > > If you don't agree with them, it would be helpful to reply to the > > review email giving the reasons why. > > I read your command and now I understand what you mean. Since they both > never return NULL the IS_ERR_OR_NULL is wrong and only IS_ERR should be > used. Correct me if I'm wrong. > About the error propagation, should I return the > syscon_regmap_lookup_by_phandle > error or I can keep the EINVAL error? Hi, You probably want something like: priv->base = syscon_node_to_regmap(np); if (IS_ERR(priv->base) && priv->base != ERR_PTR(-EPROBE_DEFER)) priv->base = syscon_regmap_lookup_by_phandle(np, "master"); if (priv->base == ERR_PTR(-EPROBE_DEFER)) { return -EPROBE_DEFER; } else if (IS_ERR(priv->base)) { dev_err(&pdev->dev, "error getting syscon regmap, error=%pe\n", priv->base); return PTR_ERR(priv->base); } Please ensure that you test the above, including the case where you should fall through to syscon_regmap_lookup_by_phandle(). -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up