summaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2015-08-27 03:44:28 (GMT)
committerSimon Glass <sjg@chromium.org>2015-08-31 13:57:29 (GMT)
commite6cabe4a6d142ab981bd31bff0795ed230caf151 (patch)
treeb06fc2afa6bf4c2e43b0fda2aaf776dec5a3472a /drivers/core/device.c
parentf6ac9f1f666a291358f8a402a3d49217ddaef80d (diff)
downloadu-boot-e6cabe4a6d142ab981bd31bff0795ed230caf151.tar.xz
dm: core: allow device_bind() to not return a device pointer
This is useful when we want to bind a device, but do not need the pointer to the device. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 01f6647..afa4b4f 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -32,7 +32,8 @@ int device_bind(struct udevice *parent, const struct driver *drv,
struct uclass *uc;
int size, ret = 0;
- *devp = NULL;
+ if (devp)
+ *devp = NULL;
if (!name)
return -EINVAL;
@@ -133,7 +134,8 @@ int device_bind(struct udevice *parent, const struct driver *drv,
if (parent)
dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
- *devp = dev;
+ if (devp)
+ *devp = dev;
dev->flags |= DM_FLAG_BOUND;