Date: Wed, 29 Jan 2025 21:57:18 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: f466ba4ca479 - main - Refactor iwmbtfw: set default firmware_dir after argument parsing Message-ID: <202501292157.50TLvI0W001409@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f466ba4ca479ec500b927deadaba104469662994 commit f466ba4ca479ec500b927deadaba104469662994 Author: Eygene Ryabinkin <rea@FreeBSD.org> AuthorDate: 2025-01-29 21:56:40 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2025-01-29 21:56:40 +0000 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 --- usr.sbin/bluetooth/iwmbtfw/main.c | 16 ++++------------ 1 file 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, ¶ms, 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, ¶ms, 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501292157.50TLvI0W001409>