Yes. This should be fine.

In fact on some GL drivers (e.g. NVidia's), the underlying generated assembly will have no subroutine call nor return in it at all (even though NVidia's ASM shader...