From: Andrew Lunn <and...@lunn.ch>
Date: Thu, 18 Apr 2019 04:31:13 +0200

> +static int dsa_tag_driver_register(struct dsa_device_ops *ops,
> +                                struct module *owner)
> +{
> +     ops->owner = owner;
> +
> +     mutex_lock(&dsa_tag_drivers_lock);
> +     list_add_tail(&ops->list, &dsa_tag_drivers_list);
> +     mutex_unlock(&dsa_tag_drivers_lock);
> +     return 0;
> +}
> +
>  int dsa_tag_drivers_register(struct dsa_device_ops *ops[],
>                            unsigned int count, struct module *owner)
>  {
> -     return 0;
> +     int err, i;
> +
> +     for (i = 0; i < count; i++) {
> +             err = dsa_tag_driver_register(ops[i], owner);
> +             if (err)
> +                     break;
> +     }
> +
> +     return err;
> +}

dsa_tag_driver_register() never returns non-zero, and anyways it's probably
not nice to return an error leaving a partial registry of the given ops
vector.  We'd have to unwind, because the calling module could unload itself
on such a failure.

Reply via email to