[PATCH] score: Replace goto with a break

Joel Sherrill joel at rtems.org
Fri Feb 10 14:23:37 UTC 2023


Looks ok to me.

On Fri, Feb 10, 2023 at 1:21 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> The goto label was directly after the loop, so we can replace the goto
> with a break.
>
> Close #4847.
> ---
>  cpukit/score/src/threaddispatch.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/cpukit/score/src/threaddispatch.c
> b/cpukit/score/src/threaddispatch.c
> index b2426fa8ac..ad4c1aca3e 100644
> --- a/cpukit/score/src/threaddispatch.c
> +++ b/cpukit/score/src/threaddispatch.c
> @@ -301,12 +301,13 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self,
> ISR_Level level )
>      heir = _Thread_Get_heir_and_make_it_executing( cpu_self );
>
>      /*
> -     *  When the heir and executing are the same, then we are being
> -     *  requested to do the post switch dispatching.  This is normally
> -     *  done to dispatch signals.
> +     * If the heir and executing are the same, then there is no need to
> do a
> +     * context switch.  Proceed to run the post switch actions.  This is
> +     * normally done to dispatch signals.
>       */
> -    if ( heir == executing )
> -      goto post_switch;
> +    if ( heir == executing ) {
> +      break;
> +    }
>
>      /*
>       *  Since heir and executing are not the same, we need to do a real
> @@ -341,7 +342,11 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self,
> ISR_Level level )
>      _ISR_Local_disable( level );
>    } while ( cpu_self->dispatch_necessary );
>
> -post_switch:
> +  /*
> +   * We are done with context switching.  Proceed to run the post switch
> +   * actions.
> +   */
> +
>    _Assert( cpu_self->thread_dispatch_disable_level == 1 );
>    cpu_self->thread_dispatch_disable_level = 0;
>    _Profiling_Thread_dispatch_enable( cpu_self, 0 );
> --
> 2.35.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230210/61e9e85a/attachment.htm>


More information about the devel mailing list