On Tue, Mar 26, 2019 at 10:06:08PM +0000, Patel, Vedang wrote:
> After pondering a little bit more, I think that switch/case is not suitable 
> in this scenario. The current we switch/case is implemented is as follows:
> 
> switch (*state) {
>       case SERVO_UNLOCKED:
>               servo->curr_offset_values = servo->num_offset_values;
>               break;
>       case SERVO_LOCKED:
>               if (check_offset_threshold(servo, offset)) {
>                       *state = SERVO_LOCKED_STABLE;
>               }
>               /* fall through. */
>       case SERVO_JUMP:
>               servo->first_update = 0;
>               break;
>       case SERVO_LOCKED_STABLE:
>               break;
>       }
> 
> But, here SERVO_LOCKED_STABLE case will never occur.

Even if it is a noop, still enumerating the cases is clearer to me.
You could add a comment explaining why that case is never reached.

Thanks,
Richard


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to