aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-06-12 18:20:18 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-06-13 12:53:11 +0200
commit40b8dd55f16ff11ab3f983fe622aa87108210e4b (patch)
treec26ebde2dc98e6efc4927fe1981e8c91ca67b5a1 /src
parentd4075bd1b8991a33e7ce793c8dd1099447e80b81 (diff)
tbf_{ul,dl}_fsm.c: Rearrange code/logs in mod_ass_type()
First print what is going to be attempted, later alarm about the possible error, finally early return. Change-Id: I417e9689f60e7f5d3c8ef67543e56fea87c8eebd
Diffstat (limited to 'src')
-rw-r--r--src/tbf_dl_fsm.c15
-rw-r--r--src/tbf_ul_fsm.c15
2 files changed, 18 insertions, 12 deletions
diff --git a/src/tbf_dl_fsm.c b/src/tbf_dl_fsm.c
index abcd0c4d..6c3f4f16 100644
--- a/src/tbf_dl_fsm.c
+++ b/src/tbf_dl_fsm.c
@@ -63,17 +63,20 @@ static void mod_ass_type(struct tbf_dl_fsm_ctx *ctx, uint8_t t, bool set)
OSMO_ASSERT(0);
}
- if (set && prev_set)
- LOGPTBFDL(ctx->dl_tbf, LOGL_ERROR,
- "attempted to set ass. type %s which is already set.\n", ch);
- else if (!set && !prev_set)
- return;
-
LOGPTBFDL(ctx->dl_tbf, LOGL_INFO, "%sset ass. type %s [prev CCCH:%u, PACCH:%u]\n",
set ? "" : "un", ch,
!!(ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)),
!!(ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH)));
+ if (set && prev_set) {
+ LOGPTBFDL(ctx->dl_tbf, LOGL_ERROR,
+ "Attempted to set ass. type %s which is already set\n", ch);
+ return;
+ }
+
+ if (!set && !prev_set)
+ return;
+
if (set)
ctx->state_flags |= (1 << t);
else
diff --git a/src/tbf_ul_fsm.c b/src/tbf_ul_fsm.c
index 5d02032b..a26d1618 100644
--- a/src/tbf_ul_fsm.c
+++ b/src/tbf_ul_fsm.c
@@ -62,17 +62,20 @@ static void mod_ass_type(struct tbf_ul_fsm_ctx *ctx, uint8_t t, bool set)
OSMO_ASSERT(0);
}
- if (set && prev_set)
- LOGPTBFUL(ctx->ul_tbf, LOGL_ERROR,
- "attempted to set ass. type %s which is already set.\n", ch);
- else if (!set && !prev_set)
- return;
-
LOGPTBFUL(ctx->ul_tbf, LOGL_INFO, "%sset ass. type %s [prev CCCH:%u, PACCH:%u]\n",
set ? "" : "un", ch,
!!(ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)),
!!(ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH)));
+ if (set && prev_set) {
+ LOGPTBFUL(ctx->ul_tbf, LOGL_ERROR,
+ "Attempted to set ass. type %s which is already set\n", ch);
+ return;
+ }
+
+ if (!set && !prev_set)
+ return;
+
if (set)
ctx->state_flags |= (1 << t);
else