Re: [PATCH v2 3/5] dpp: explicitly disconnect station if enrollee is started

Denis Kenzior
2024-07-24T15:15:56Z

Hi James,

>>> +    /* Unusual case, but an enrollee could still be started */
>>> +    if (!station)
>>> +        return false;
>>
>> Function signature returns int, but you're returning false.
>
> Yep this is intended.
>
> true for a disconnect has started or is ongoing.
> false for already disconnected
> < 0 for a fatal error (i.e. station_disconnect() failed)
>

The typical convention is:
-errno -> error
0 - > success

You can extend this to mean that 0...INT_MAX is a success and return value
simultaneously. Mixing integers and bools is not what vast majority of people
would expect and should be avoided.

> If this isn't desirable we could do:
>
> -EALREADY for a disconnect is started/ongoing
> 0 for already disconnected
> < 0 for a fatal error

That would be better. Another alternative is:

int dpp_try_disconnect_station(struct dpp_sm *dpp, bool *out_disconnect_started);

Regards,
-Denis