diff --git a/src/shared/att.c b/src/shared/att.c
index 8657cb6..14d346c 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
{
struct bt_security sec;
+ if (chan->type == BT_ATT_LOCAL) {
+ chan->sec_level = level;
+ return true;
+ }
+
/* Check if security level has already been set, if the security level
* is higher it shall satisfy the request since we never want to
* downgrade security.
if (level <= bt_att_chan_get_security(chan))
return true;
- if (chan->type == BT_ATT_LOCAL) {
- chan->sec_level = level;
- return true;
- }
-
memset(&sec, 0, sizeof(sec));
sec.level = level;