tools: Switch hciattach_qualcomm to FAILIF macro completely
authorMarek Vasut <marex@denx.de>
Tue, 1 Nov 2022 20:26:36 +0000 (21:26 +0100)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
Use the FAILIF() macro consistently to avoid unused variable n warnings.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/hciattach_qualcomm.c

index 2fcf54b..8049645 100755 (executable)
@@ -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]);