On 04/18/2019 04:19 PM, Andrew Lunn wrote: >>> Let the tag drivers register themselves with the DSA core, keeping >>> them in a linked list. >>> >>> Signed-off-by: Andrew Lunn <and...@lunn.ch> >>> --- >>> include/net/dsa.h | 2 ++ >>> net/dsa/dsa.c | 35 ++++++++++++++++++++++++++++++++++- >>> 2 files changed, 36 insertions(+), 1 deletion(-) >>> >> [...] >>> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c >>> index a49e230b6247..861fe1441a7d 100644 >>> --- a/net/dsa/dsa.c >>> +++ b/net/dsa/dsa.c >>> @@ -27,6 +27,9 @@ >> [...] >>> 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; >> >> What if count == 0? Can't happen? > > Hi Sergei > > The current drivers would prevent that. But to be robust, i will add a > check.
You'd just need to init the variavble. :-) > Thanks > Andrew MBR, Sergei