[3/3] fsl/fman: Return directly after a failed devm_kzalloc() in mac_probe()
diff mbox series

Message ID 8ffc16a2-62cc-f948-e11b-55bae1d6aae4@web.de
State Rejected
Delegated to: David Miller
Headers show
Series
  • FMan MAC: Improve exception handling in mac_probe()
Related show

Commit Message

Markus Elfring Nov. 9, 2019, 9:06 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Nov 2019 09:26:12 +0100

Return directly after a call of the function “devm_kzalloc” failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/freescale/fman/mac.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

--
2.24.0

Patch
diff mbox series

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 7fbd7cc24ede..75614e2ebda3 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -614,15 +614,12 @@  static int mac_probe(struct platform_device *_of_dev)
 	mac_node = dev->of_node;

 	mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL);
-	if (!mac_dev) {
-		err = -ENOMEM;
-		goto _return;
-	}
+	if (!mac_dev)
+		return -ENOMEM;
+
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		err = -ENOMEM;
-		goto _return;
-	}
+	if (!priv)
+		return -ENOMEM;

 	/* Save private information */
 	mac_dev->priv = priv;