[U-Boot] [RFC PATCH 09/12] dm: merge fail_alloc labels

Masahiro Yamada yamada.masahiro at socionext.com
Wed Jul 8 06:29:39 CEST 2015


A little more clean up made possible by devm_kzalloc().

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

 drivers/core/device.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index f024aa2..25b9b63 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -80,7 +80,7 @@ int device_bind(struct udevice *parent, const struct driver *drv,
 					     GFP_KERNEL);
 		if (!dev->platdata) {
 			ret = -ENOMEM;
-			goto fail_alloc1;
+			goto fail_alloc;
 		}
 	}
 
@@ -89,7 +89,7 @@ int device_bind(struct udevice *parent, const struct driver *drv,
 		dev->uclass_platdata = devm_kzalloc(dev, size, GFP_KERNEL);
 		if (!dev->uclass_platdata) {
 			ret = -ENOMEM;
-			goto fail_alloc2;
+			goto fail_alloc;
 		}
 	}
 
@@ -104,7 +104,7 @@ int device_bind(struct udevice *parent, const struct driver *drv,
 							    GFP_KERNEL);
 			if (!dev->parent_platdata) {
 				ret = -ENOMEM;
-				goto fail_alloc3;
+				goto fail_alloc;
 			}
 		}
 	}
@@ -156,9 +156,7 @@ fail_uclass_bind:
 	if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) {
 		list_del(&dev->sibling_node);
 	}
-fail_alloc3:
-fail_alloc2:
-fail_alloc1:
+fail_alloc:
 	devres_release_all(dev);
 
 	free(dev);
-- 
1.9.1



More information about the U-Boot mailing list