[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418.002534.2005887817514635521.davem@davemloft.net>
Date: Thu, 18 Apr 2019 00:25:34 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: andrew@...n.ch
Cc: netdev@...r.kernel.org, f.fainelli@...il.com,
vivien.didelot@...il.com
Subject: Re: [PATCH net-next 08/15] dsa: Keep link list of tag drivers
From: Andrew Lunn <andrew@...n.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.
Powered by blists - more mailing lists