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

Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
---

Changes in v2: None

 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 65b8a14..bcae3ba 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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to