[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1884803a-69fc-7b7a-2160-983ab0b38898@cogentembedded.com>
Date: Thu, 18 Apr 2019 17:40:44 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Andrew Lunn <andrew@...n.ch>
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 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 <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.
You'd just need to init the variavble. :-)
> Thanks
> Andrew
MBR, Sergei
Powered by blists - more mailing lists