From: Marek Vasut Date: Tue, 1 Nov 2022 20:26:36 +0000 (+0100) Subject: tools: Switch hciattach_qualcomm to FAILIF macro completely X-Git-Tag: accepted/tizen/unified/20230608.164325~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e47d4f5dbb0bb49604e5b0aef71ca9ceec1e6d7;p=platform%2Fupstream%2Fbluez.git tools: Switch hciattach_qualcomm to FAILIF macro completely Use the FAILIF() macro consistently to avoid unused variable n warnings. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- diff --git a/tools/hciattach_qualcomm.c b/tools/hciattach_qualcomm.c index 2fcf54b8..8049645a 100755 --- a/tools/hciattach_qualcomm.c +++ b/tools/hciattach_qualcomm.c @@ -174,10 +174,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]); @@ -214,10 +212,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); @@ -228,10 +224,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); @@ -249,10 +243,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]);