From patchwork Wed Sep 22 10:27:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1531156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ga8Uhzw+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HDvd11kMRz9sW4 for ; Wed, 22 Sep 2021 20:27:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mSzTd-0001Tp-Ic; Wed, 22 Sep 2021 10:27:45 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mSzTc-0001Tj-2B for fwts-devel@lists.ubuntu.com; Wed, 22 Sep 2021 10:27:44 +0000 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id B731D4191E; Wed, 22 Sep 2021 10:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632306463; bh=NJ0qJgbxoW/sHtz3X4ldku/+GwK+3q697QX/WtjJx5Q=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; b=ga8Uhzw+fciVzJD1MBQSge2HVh1T0vItO5cfeHULqLDzw+uQHPE6LQrth8x9yxNZp dMWPJdTChKRu/LgQJUyrps5maDS5R3i/Kl8dPXE9Hof3rMv3qM9r7FtKC5FnCfU0Dd X57btLC/lmmJnL1t2UpmJJJh1xTmL13RiYg8PCMntOslGoT6v76nFth17FsDi2Pk6d xFxOlMGlsSWpJtlUCDTmpJ+TPMJuiQ1e7uY26MWzmXFDd6iuxl5QWjQikV2ICgiwIE jRTUpYggeAg3VpTp6E7nWMpo8817jzbz1VaSgzu0/t6WkwIpfkqwakw8m7kAEPRNMv YAA+uPNi6bwrA== From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] src/pci/smccc: reduce scope of variable ret Date: Wed, 22 Sep 2021 11:27:43 +0100 Message-Id: <20210922102743.178098-1-colin.king@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Variables ret are used in a deeper scope, move these to clean up cppcheck style warnings. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/pci/smccc/smccc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pci/smccc/smccc.c b/src/pci/smccc/smccc.c index a94d0b39..c25a9b97 100644 --- a/src/pci/smccc/smccc.c +++ b/src/pci/smccc/smccc.c @@ -200,7 +200,7 @@ static int smccc_pci_version_test(fwts_framework *fw) static int smccc_pci_features_test(fwts_framework *fw) { struct smccc_test_arg arg = { }; - int ret, implemented_funcs = 0; + int implemented_funcs = 0; bool passed = true; static const char *test = "SMCCC v1.0 PCI_FEATURES"; size_t i; @@ -209,6 +209,8 @@ static int smccc_pci_features_test(fwts_framework *fw) * Check SMCCC functions are implemented in the firmware */ for (i = 0; i < FWTS_ARRAY_SIZE(pci_func_ids); i++) { + int ret; + memset(&arg, 0, sizeof(arg)); /* Assume it is not implemented */ @@ -253,7 +255,7 @@ static int smccc_pci_features_test(fwts_framework *fw) static int smccc_pci_get_seg_info(fwts_framework *fw) { struct smccc_test_arg arg = { }; - int ret, segments = 0; + int segments = 0; bool passed = true; static const char *test = "SMCCC v1.0 PCI_GET_SEG_INFO"; int i; @@ -267,6 +269,8 @@ static int smccc_pci_get_seg_info(fwts_framework *fw) * Scan over all potential 65536 segment infos.. */ for (i = 0; i <= 0xffff; i++) { + int ret; + memset(&arg, 0, sizeof(arg)); arg.size = sizeof(arg);