Skip to content

Commit

Permalink
tools: Switch hciattach_qualcomm to FAILIF macro completely
Browse files Browse the repository at this point in the history
Use the FAILIF() macro consistently to avoid unused variable n warnings.
  • Loading branch information
Marek Vasut authored and Vudentz committed Nov 1, 2022
1 parent d925324 commit f9657b8
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions tools/hciattach_qualcomm.c
Expand Up @@ -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]);
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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]);

Expand Down

0 comments on commit f9657b8

Please sign in to comment.