From deaef51d0751162ca9a5092dee0d81b2419b50d5 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 26 Sep 2024 10:19:54 +0200 Subject: [PATCH] modemmanager: improvement of readability by reversing the query No functional change. The change makes reading the source clearer. Signed-off-by: Florian Eckert --- .../files/lib/netifd/proto/modemmanager.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh index 0827c27136..23d73c7550 100644 --- a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh +++ b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh @@ -338,19 +338,20 @@ modemmanager_check_state_locked() { local modemstatus="$3" local pincode="$4" - if [ -n "$pincode" ]; then - mmcli --modem="${device}" -i any --pin=${pincode} || { - proto_notify_error "${interface}" MM_PINCODE_WRONG - proto_block_restart "${interface}" - return 1 - } - return 0 - else + if [ -z "$pincode" ]; then echo "PIN required" proto_notify_error "${interface}" MM_PINCODE_REQUIRED proto_block_restart "${interface}" return 1 fi + + mmcli --modem="${device}" -i any --pin=${pincode} || { + proto_notify_error "${interface}" MM_PINCODE_WRONG + proto_block_restart "${interface}" + return 1 + } + + return 0 } modemmanager_check_state() { -- 2.30.2