X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-context.c;h=0492ecbfacd3d51e92537a322772727b6839079f;hb=fca2e14e1d57d7b89d1a6de07075cc0e6e157ca7;hp=a7010dbb1c516d7974ba999e1bb3ec3208e23fbf;hpb=e6d40a8447eff5e1be00ea35715092876e0520fa;p=src%2Fapp-framework-binder.git diff --git a/src/afb-context.c b/src/afb-context.c index a7010dbb..0492ecbf 100644 --- a/src/afb-context.c +++ b/src/afb-context.c @@ -138,16 +138,19 @@ int afb_context_check_loa(struct afb_context *context, unsigned loa) return context->loa_in >= loa; } -void afb_context_change_loa(struct afb_context *context, unsigned loa) +int afb_context_change_loa(struct afb_context *context, unsigned loa) { - assert(context->validated); + if (!context->validated || loa > 7) + return 0; - if (loa == context->loa_in) + if (loa == context->loa_in && !context->loa_changed) context->loa_changing = 0; else { - context->loa_changing = 1; context->loa_out = loa & 7; + context->loa_changing = 1; + context->loa_changed = 0; } + return 1; }