Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2925003rwi; Tue, 1 Nov 2022 13:32:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bqogD0Kk4tFIKCgDqmL8m4ZB376X1auHy9VB+GCxYnFmqqrxdDXmyzIADdfC7BrsLDuqN X-Received: by 2002:a17:907:3f95:b0:7a2:36c7:31bd with SMTP id hr21-20020a1709073f9500b007a236c731bdmr20519465ejc.353.1667334764403; Tue, 01 Nov 2022 13:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667334764; cv=none; d=google.com; s=arc-20160816; b=mSn59xsXUULebTE6Q0D77++/KYBby8dmWRQ9qUxnFTMmvzte5CksbOwu8sgc0ox1Z4 ysd7AqV0Ng6S13EwNeWcuRVsjOPvlgAl5jiCnyPkfEmcf/eFMx7FLpc6fMAjBVMYoSxM s9o+XECdCZhkYutxi2qQZ1sXTIWtEVRn3nClKmXqnEsX6ZReKfWisLMYAophFH8jUWa4 jv9ZMqTQpRkcoIxMS36NbNDCtls5yZvUKwFdftCm6iHvq1x7S0L6xtGDKQnmQPGFq3NP sac5BwdocORi7V0npc/FbDl/xIDe5ZvrWPPmI84lre+bYxGRY0A6WAjss3w2WEjpo3ej lkWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BI0DSBzt0iCEGjMm9lMBHI/sxUx7WMYe3vKEcXVY5/4=; b=EoZ251eHB2WsCPMpYKZIpyh9xSxeSbhf6g5ZJBiP2b4gTy5Oii2fE35TUWl0RE0qge 0g1WqlpgWbfFy+0wegX8LrRPi0EqHXgmZoDEhpZ4E6EQgiOiv1nt3Cd07ysDzivhSXz1 TbHTpj665eJBWHnIXhWSRqjoKd3V7DBJNMvDZtmIq5pmN4w0Jsvm7gWnraALRLmevyVR xJypQLIVAaqI4ylMw0sE1NTYTt7C7yOP7zhyvudToVi0uTfAj4/7KJyFth9BGHlkgLT4 H6E/kShxxKWwgZb8rXWqKsYHFcnVgrlEfWBqj7MPefKweSK+5edg0m7wg9x82epRNysG Cmmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=QJhXesLC; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz19-20020a0564021d5300b00459fb0c1d9esi13937581edb.549.2022.11.01.13.32.03; Tue, 01 Nov 2022 13:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=QJhXesLC; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229695AbiKAU1X (ORCPT + 99 others); Tue, 1 Nov 2022 16:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiKAU0y (ORCPT ); Tue, 1 Nov 2022 16:26:54 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C44F817052 for ; Tue, 1 Nov 2022 13:26:52 -0700 (PDT) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id C9E7881E72; Tue, 1 Nov 2022 21:26:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1667334409; bh=BI0DSBzt0iCEGjMm9lMBHI/sxUx7WMYe3vKEcXVY5/4=; h=From:To:Cc:Subject:Date:From; b=QJhXesLC7GzrBVykzX1wa9FEhBOY9tMp/YftWDJhF3XHdmLKLzzLub+wD/RBApejn wOoJmHzcwqxQb+2+5HS9oVmgYYMmxSTdFdP/kyZb08Zkae/JmkS2O6JlXISLW6G1Ct 0i6viBsRtXEA877zQun+M5U+dAIciJEgLxx2Dt6tRXs3JJ9/pBUqlNynundlCwcm12 YQjwe/wl+2T7+Hm2cBLd9VoLQ6BiKpi3qyZu6BKXrmI4TpfV7oKdy1k1xTedIXOKRK YyHsariu40Ste2/znS+UWMjwETdkvBkzBlPhyKeK0P4MF/FgLxJ4YOxPmSVQxohOie Ad80WXxX76isw== From: Marek Vasut To: linux-bluetooth@vger.kernel.org Cc: Marek Vasut Subject: [PATCH BlueZ] tools: Switch hciattach_qualcomm to FAILIF macro completely Date: Tue, 1 Nov 2022 21:26:36 +0100 Message-Id: <20221101202636.143165-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Use the FAILIF() macro consistently to avoid unused variable n warnings. Signed-off-by: Marek Vasut --- 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