From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio Estevam Subject: [PATCH net-next] net: phy: fixed-phy: Make the error path simpler Date: Sat, 23 Jun 2018 21:28:22 -0300 Message-ID: <1529800102-18287-1-git-send-email-festevam@gmail.com> Cc: andrew@lunn.ch, f.fainelli@gmail.com, netdev@vger.kernel.org, Fabio Estevam To: davem@davemloft.net Return-path: Received: from mail-qt0-f195.google.com ([209.85.216.195]:38513 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbeFXA2I (ORCPT ); Sat, 23 Jun 2018 20:28:08 -0400 Received: by mail-qt0-f195.google.com with SMTP id e11-v6so8572033qtp.5 for ; Sat, 23 Jun 2018 17:28:08 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: From: Fabio Estevam When platform_device_register_simple() fails we can return the error immediately instead of jumping to the 'err_pdev' label. This makes the error path a bit simpler. Signed-off-by: Fabio Estevam --- drivers/net/phy/fixed_phy.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index 001fe1d..67b2608 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -259,10 +259,8 @@ static int __init fixed_mdio_bus_init(void) int ret; pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - goto err_pdev; - } + if (IS_ERR(pdev)) + return PTR_ERR(pdev); fmb->mii_bus = mdiobus_alloc(); if (fmb->mii_bus == NULL) { @@ -287,7 +285,6 @@ static int __init fixed_mdio_bus_init(void) mdiobus_free(fmb->mii_bus); err_mdiobus_reg: platform_device_unregister(pdev); -err_pdev: return ret; } module_init(fixed_mdio_bus_init); -- 2.7.4