On 26/11/2018 19:39, Stephen Hemminger wrote:
> On Sun, 25 Nov 2018 10:12:45 +0200
> Nikolay Aleksandrov <niko...@cumulusnetworks.com> wrote:
> 
>> On 24/11/2018 18:46, niko...@cumulusnetworks.com wrote:
>>> On 24 November 2018 18:25:41 EET, Andrew Lunn <and...@lunn.ch> wrote:  
>>>> On Sat, Nov 24, 2018 at 06:18:33PM +0200, niko...@cumulusnetworks.com
>>>> wrote:  
>>>>> On 24 November 2018 18:10:41 EET, Andrew Lunn <and...@lunn.ch> wrote:  
>>>>>>> +int br_boolopt_toggle(struct net_bridge *br, enum br_boolopt_id  
>>>> opt,  
>>>>>> bool on,  
>>>>>>> +                     struct netlink_ext_ack *extack)
>>>>>>> +{
>>>>>>> +       switch (opt) {
>>>>>>> +       default:
>>>>>>> +               /* shouldn't be called with unsupported options */
>>>>>>> +               WARN_ON(1);
>>>>>>> +               break;  
>>>>>>
>>>>>> So you return 0 here, meaning the br_debug() lower down will not
>>>>>> happen. Maybe return -EOPNOTSUPP?
>>>>>>  
>>>>>
>>>>> No, the idea here is that some option in the future might return an  
>>>> error.   
>>>>> This function cannot be called with unsupported option thus the warn.  
> 
>>
> 
> Please don't implement some part of the API until it is used (YAGNI).
> If do this kind of "someday will come" design the code will end up
> littered with dead ends.
> 

Is there anything unused ? This is just a precaution to catch future
offenders which forget to handle options where they're expected.
All of the API is used.

Reply via email to