aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEygene Ryabinkin <rea@FreeBSD.org>2025-01-29 21:56:40 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2025-01-29 21:56:40 +0000
commitf466ba4ca479ec500b927deadaba104469662994 (patch)
tree2e78c34c19dfaefb20ac3509e80371e1f8f73d96
parent9fab5bbc38b7efc7c3361b4a33c89cdf98f4e2de (diff)
Refactor iwmbtfw: set default firmware_dir after argument parsing
Don't repeat firmware_dir stanza at all "if" branches: be more DRY. Signed-off-by: Eygene Ryabinkin <rea@FreeBSD.org> Reviewed by: wulf MFC after: 1 month
-rw-r--r--usr.sbin/bluetooth/iwmbtfw/main.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c
index 9c899d374e92..e4bb22af0e8a 100644
--- a/usr.sbin/bluetooth/iwmbtfw/main.c
+++ b/usr.sbin/bluetooth/iwmbtfw/main.c
@@ -451,6 +451,10 @@ main(int argc, char *argv[])
/* NOTREACHED */
}
+ /* Default the firmware path */
+ if (firmware_dir == NULL)
+ firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH);
+
/* libusb setup */
r = libusb_init(&ctx);
if (r != 0) {
@@ -508,10 +512,6 @@ main(int argc, char *argv[])
goto reset;
}
- /* Default the firmware path */
- if (firmware_dir == NULL)
- firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH);
-
firmware_path = iwmbt_get_fwname(&ver, &params, firmware_dir, "bseq");
if (firmware_path == NULL)
goto shutdown;
@@ -603,10 +603,6 @@ main(int argc, char *argv[])
goto shutdown;
}
- /* Default the firmware path */
- if (firmware_dir == NULL)
- firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH);
-
firmware_path = iwmbt_get_fwname(&ver, &params, firmware_dir, "sfi");
if (firmware_path == NULL)
goto shutdown;
@@ -689,10 +685,6 @@ main(int argc, char *argv[])
goto shutdown;
}
- /* Default the firmware path */
- if (firmware_dir == NULL)
- firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH);
-
firmware_path = iwmbt_get_fwname_tlv(&ver_tlv, firmware_dir, "sfi");
if (firmware_path == NULL)
goto shutdown;