[U-Boot] [RFC v3 PATCH 1/4] dm: do not return pointer if NULL is given to devp of device_bind()

Simon Glass sjg at chromium.org
Wed Aug 12 16:15:28 CEST 2015


Hi Masahiro,

On 10 August 2015 at 10:05, Masahiro Yamada
<yamada.masahiro at socionext.com> wrote:
> This is useful when we want to bind a device, but do not need the
> device pointer.

Could adjust the subject to something shorter, like "dm: core: Allow
device_bind() to not return the device"

>
> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> ---
>
>  drivers/core/device.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/core/device.c b/drivers/core/device.c
> index e23a872..634070c 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;
>
> --
> 1.9.1
>

Please can you update the function comments for device_bind()?

Regards,
Simon


More information about the U-Boot mailing list