[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190418131947.GB542@lunn.ch>
Date: Thu, 18 Apr 2019 15:19:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net-next 08/15] dsa: Keep link list of tag drivers
On Thu, Apr 18, 2019 at 12:35:44PM +0300, Sergei Shtylyov wrote:
> On 18.04.2019 5:31, Andrew Lunn wrote:
>
> >Let the tag drivers register themselves with the DSA core, keeping
> >them in a linked list.
> >
> >Signed-off-by: Andrew Lunn <andrew@...n.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.
Thanks
Andrew
Powered by blists - more mailing lists