From patchwork Sat Oct 26 06:35:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 13852079 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C93017BB07 for ; Sat, 26 Oct 2024 06:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729924564; cv=none; b=XIMCJcQ+RW++tiY32kFAZcAVCUp6ylxKHVMXGK1NccGj3ciKN+TrPuhxaxfNf/si9KYR/l2TCjTWplBrJUzKNh0urh+I/sB5VIr6uonbEjiKTqo+9/AcW631jdBQgJhL+pSVEqJv+OJIWOAHkRLYYgtmUCUCpzx6UGtn2Yqwdc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729924564; c=relaxed/simple; bh=PyA6XkLuW//YJHuLU9e9e+Uvse6PTMXkl5C2E+oqirI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jw7kU+A6fUpKbFKhaXDRSie1uJy4i++uG+JHTwDG+K6NO3SLR+8l+rdQU9RNqOD0OrNYzpjDkoJHymQ9BpnWl3lqz4PnhEdi241MHYEje8A7cdAbOo1PD3TUtmY1hPR/EieqI/79P/balmf1DCC3PxL6VDXXqQKTMl0LEoBvQfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4aOj-0006kD-1l; Sat, 26 Oct 2024 08:35:41 +0200 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1t4aOh-000UfO-0Y; Sat, 26 Oct 2024 08:35:39 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1t4aOh-00AVyn-0E; Sat, 26 Oct 2024 08:35:39 +0200 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss , Conor Dooley , Krzysztof Kozlowski , Rob Herring Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, "Russell King (Oracle)" , devicetree@vger.kernel.org Subject: [PATCH net-next v1 4/5] net: dsa: microchip: cleanup error handling in ksz_mdio_register Date: Sat, 26 Oct 2024 08:35:37 +0200 Message-Id: <20241026063538.2506143-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241026063538.2506143-1-o.rempel@pengutronix.de> References: <20241026063538.2506143-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace repeated cleanup code with a single error path using a label. Signed-off-by: Oleksij Rempel --- drivers/net/dsa/microchip/ksz_common.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index bcd963191cb25..f08fa52dd1387 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2339,8 +2339,8 @@ static int ksz_mdio_register(struct ksz_device *dev) bus = devm_mdiobus_alloc(ds->dev); if (!bus) { - of_node_put(mdio_np); - return -ENOMEM; + ret = -ENOMEM; + goto put_mdio_node; } if (dev->dev_ops->mdio_bus_preinit) { @@ -2385,10 +2385,8 @@ static int ksz_mdio_register(struct ksz_device *dev) if (dev->irq > 0) { ret = ksz_irq_phy_setup(dev); - if (ret) { - of_node_put(mdio_np); - return ret; - } + if (ret) + goto put_mdio_node; } ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);