From: Marek Vasut <marex@denx.de>
To: linux-bluetooth@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>
Subject: [PATCH BlueZ] tools: Switch hciattach_qualcomm to FAILIF macro completely
Date: Tue, 1 Nov 2022 21:26:36 +0100 [thread overview]
Message-ID: <20221101202636.143165-1-marex@denx.de> (raw)
Use the FAILIF() macro consistently to avoid unused variable n warnings.
Signed-off-by: Marek Vasut <marex@denx.de>
---
tools/hciattach_qualcomm.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/tools/hciattach_qualcomm.c b/tools/hciattach_qualcomm.c
index d228aeec0..d751f42b1 100644
--- a/tools/hciattach_qualcomm.c
+++ b/tools/hciattach_qualcomm.c
@@ -175,10 +175,8 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr)
}
/* Read reply. */
- if (read_hci_event(fd, resp, 100) < 0) {
- perror("Failed to read init response");
- return -1;
- }
+ n = read_hci_event(fd, resp, 100);
+ FAILIF(n < 0, "Failed to read init response");
/* Wait for command complete event for our Opcode */
} while (resp[4] != cmd[1] && resp[5] != cmd[2]);
@@ -215,10 +213,8 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr)
}
/* Read reply. */
- if ((n = read_hci_event(fd, resp, 100)) < 0) {
- perror("Failed to read vendor init response");
- return -1;
- }
+ n = read_hci_event(fd, resp, 100);
+ FAILIF(n < 0, "Failed to read vendor init response");
} while (resp[3] != 0 && resp[4] != 2);
@@ -229,10 +225,8 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr)
resp[32], resp[33], resp[34], resp[35]);
/* Wait for command complete event for our Opcode */
- if (read_hci_event(fd, resp, 100) < 0) {
- perror("Failed to read init response");
- return -1;
- }
+ n = read_hci_event(fd, resp, 100);
+ FAILIF(n < 0, "Failed to read init response");
qualcomm_load_firmware(fd, fw, bdaddr);
@@ -250,10 +244,8 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr)
}
/* Read reply. */
- if ((n = read_hci_event(fd, resp, 100)) < 0) {
- perror("Failed to read reset response");
- return -1;
- }
+ n = read_hci_event(fd, resp, 100);
+ FAILIF(n < 0, "Failed to read reset response");
} while (resp[4] != cmd[1] && resp[5] != cmd[2]);
--
2.35.1
next reply other threads:[~2022-11-01 20:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 20:26 Marek Vasut [this message]
2022-11-01 21:10 ` [PATCH BlueZ] tools: Switch hciattach_qualcomm to FAILIF macro completely patchwork-bot+bluetooth
2022-11-01 21:21 ` [BlueZ] " bluez.test.bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221101202636.143165-1-marex@denx.de \
--to=marex@denx.de \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox