From patchwork Tue Jul 21 10:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 11675289 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1287114E3 for ; Tue, 21 Jul 2020 10:05:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E033920717 for ; Tue, 21 Jul 2020 10:05:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="b3q0qro2"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="wyrFZ6PQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E033920717 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5z80Y79V/wIeNdaZBcw6sBIMhGIzr8MnDvkmGH+wBU8=; b=b3q0qro2Iyu/NSbskdBPriY4O wjWWzMkUqN3gSieHY3fcVfdN0KT3WdCz7gU0zOzBRytfpRC18+uVwb3/jqpEffqyAgWS9SLv0KFCT wxhlBzMKT68Lv6wi1bAgSz0+n6jidChEcQiAsRzOMZIkmK+tQgbaiA6EX8VU9vdFnqKWtQrmzK1Lq W4ySWhfRnErXlwIPcVpQFzhZ9R9N3OyqU+csa4SztARue5c+E6niLS6xEd9xtmOfgTu9mvzezkPQP eb777VsAX39SEbm6OCwIHxTmBhOdzgAgi/CC5uex2lss5hv2og0rCOcTTlFEMGbfOsLWf4m0REa1u 9w5gjuUbQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxp8L-0005LP-0k; Tue, 21 Jul 2020 10:04:25 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxp8I-0005KL-Mh for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 10:04:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595325862; x=1626861862; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eSIX9gvTOXmEs7WsXT0EHbET3IDNtZUzetyMiaF7M2E=; b=wyrFZ6PQHH/0naGNz+w95xuXo6D/AYxunR3odiieOJMDgYsXNJHMEpzl IGrpQPzfy0+Q6CQMzVg7lDwEQ5MANfg9QcHnq5M5shTr3bpVepdC2gh31 nvzDh19IuYOHevXhi25B3b1ti4vxIl056ej+F8M0wLoh7V3B6gJSu32Ca mzs370/WuwFf3OwlwkZbhXMoWrACYnErRf0t3ZRq9A8/FAwwFLKYs+0d9 MwOzvOhUek7Rth9zXzGrCE7wijl4DJ8RuMkQfRUUb5/OSGrx2FJp7+1bg mFn18MgQrOiy9P1MRbePAOGd3qLRWaLRL1N95xJg+hNT3PBGJ/d8E/sFV w==; IronPort-SDR: zOL0rLzTbWq08z6asHBEwBpO7+4x8fKeWDVGqFBbISHYCIF5dzCVSQC3v/TBGjXvRIpczDInsE SsA+eb169b3oh0iUPbjGpZSG/0dl0jOJ9FzQ0UXdScK2OHGag3a+npeDy/G681MpwZWDgFX7V+ 15m7nsaiGjar/RSWR3Vt8VHzLmBoVOVqpck9JBVo2qkm0+8ZCE+HI5Mmyc4JI/4EhuLLzwzo29 IpHHw9496cLmIl7TflLImllpWPwM1Y2nM0pP0UYxeyxrQxhdpI6Be2ahFCxZ89iJZCVTDQcn52 JgA= X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="80694800" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Jul 2020 03:04:20 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 21 Jul 2020 03:03:42 -0700 Received: from rob-ult-m19940.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 21 Jul 2020 03:02:58 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH net-next 1/7] net: macb: use device-managed devm_mdiobus_alloc() Date: Tue, 21 Jul 2020 13:02:28 +0300 Message-ID: <20200721100234.1302910-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721100234.1302910-1-codrin.ciubotariu@microchip.com> References: <20200721100234.1302910-1-codrin.ciubotariu@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_060422_863327_54D829F1 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [68.232.154.123 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, alexandre.belloni@bootlin.com, f.fainelli@gmail.com, claudiu.beznea@microchip.com, ludovic.desroches@microchip.com, robh+dt@kernel.org, kuba@kernel.org, Codrin Ciubotariu , davem@davemloft.net Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the device-managed variant for the allocating the MDIO bus. This cleans-up the code a little on the remove and error paths. Signed-off-by: Codrin Ciubotariu --- drivers/net/ethernet/cadence/macb_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index a6a35e1b0115..89fe7af5e408 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -769,7 +769,7 @@ static int macb_mii_init(struct macb *bp) /* Enable management port */ macb_writel(bp, NCR, MACB_BIT(MPE)); - bp->mii_bus = mdiobus_alloc(); + bp->mii_bus = devm_mdiobus_alloc(&bp->pdev->dev); if (!bp->mii_bus) { err = -ENOMEM; goto err_out; @@ -787,7 +787,7 @@ static int macb_mii_init(struct macb *bp) err = macb_mdiobus_register(bp); if (err) - goto err_out_free_mdiobus; + goto err_out; err = macb_mii_probe(bp->dev); if (err) @@ -797,8 +797,6 @@ static int macb_mii_init(struct macb *bp) err_out_unregister_bus: mdiobus_unregister(bp->mii_bus); -err_out_free_mdiobus: - mdiobus_free(bp->mii_bus); err_out: return err; } @@ -4571,7 +4569,6 @@ static int macb_probe(struct platform_device *pdev) err_out_unregister_mdio: mdiobus_unregister(bp->mii_bus); - mdiobus_free(bp->mii_bus); err_out_free_netdev: free_netdev(dev); @@ -4599,7 +4596,6 @@ static int macb_remove(struct platform_device *pdev) if (dev) { bp = netdev_priv(dev); mdiobus_unregister(bp->mii_bus); - mdiobus_free(bp->mii_bus); unregister_netdev(dev); tasklet_kill(&bp->hresp_err_tasklet);