From patchwork Wed Jan 13 20:51:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101175 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3599197lbb; Wed, 13 Jan 2016 12:52:03 -0800 (PST) X-Received: by 10.98.72.87 with SMTP id v84mr379289pfa.15.1452718323677; Wed, 13 Jan 2016 12:52:03 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q83si4164693pfi.128.2016.01.13.12.52.03; Wed, 13 Jan 2016 12:52:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758721AbcAMUwC (ORCPT + 1 other); Wed, 13 Jan 2016 15:52:02 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:49743 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758720AbcAMUwB (ORCPT ); Wed, 13 Jan 2016 15:52:01 -0500 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0MMnK3-1aFrcR0I3T-008dNc; Wed, 13 Jan 2016 21:51:32 +0100 From: Arnd Bergmann To: broonie@kernel.org Cc: Martin Sperl , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: fix counting in spi-loopback-test code Date: Wed, 13 Jan 2016 21:51:29 +0100 Message-ID: <7416604.jejCLcpcOT@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:+gz23DWeaIt6jsgOA+albKPXQRRNS5rjC/Jvixq1AHcPz2RSkzu Au607lkGSgJ4rlAX35X28cqMk5FApJa6Oj66dWZoCfFf7YtiIMkbzhmFExjbx2pwL6V3l+B YAQT42sVp2O3/tuG5w2nuMqKMBHrgwVZ8m2YZmF6RIhYodBSctCfBkD7IeK/mc8fgVZHVAH iT0l/wq8/t+neplURuGGQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Ubw3mR3ONkY=:GRqHC210ADNsaId1WVB7wL lgiZmCKonx80r3GT5BQlzEeASlDlhfpL02mdKV9s9tCyynrylf5G9ojFNH/L8MWpXGZGho8Y1 WLAK3u+EFICoG4XThfyVMl+B9pvh+ZuQs2itMVCmuntPa/1MqSboMDDzXB98eR9LzmKhGKGuN jNAYfO2gXT0Ati+8kwO1SGMKQgr4I1u0pi5fHJ1kRGaG+FmLtVypwGIsLW9WCmwuT4NO49yTS z7CXM9gNt6wAf3ylB+SOo6MK1geigJIWabNddCLDiC5DuKBbrXIbf+TSH22a40rfU2cGP73Mr 7wrSngkVf1SqacyYYDGlRt/FyXka31UhUGO63aBHuu1SWB33sBOvurnijEHsHFM8KxY7GvmAQ 91+OTnELBmektqH5DWzjAqqwsLiYe3nUKJU2lxGvZPHJ408Zg7hLUzLTCNVk69QroYvYy4c+X duhsSIWF1QeyGXkwa38x776YCfOJW7iaOtXlRbpkoowrOLbMmjcuSXQaSnxsvI1wUBDo8RKlD a69DE6p0BkEOnzScYcrQq/AR6Kulz+6mwkJyJ6Bwe21nxiH5QylJYzxWs18clWCNsUpd7XJDS M8Fclz2amcuyvDzUZ030gej2cGpICRyYyuZRbQ29jI+ovq+5zahCK8YKLA3fjkyXQYolUF9W1 tbdnQJWYnRqoL7A1dnO0qPKmHnF5VxGuZrLSb4M+EG6jfMBTB31yvwr4DamEd13kWRpsF7c9E qbhWnTag/PEENGYf Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org These variables are always used uninitialized: drivers/spi/spi-loopback-test.c: In function 'spi_test_run_iter': drivers/spi/spi-loopback-test.c:768:17: warning: 'rx_count' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/spi/spi-loopback-test.c:762:17: warning: 'tx_count' may be used uninitialized in this function [-Wmaybe-uninitialized] Adding an explicit initialization seems to be the only workable solution here, to make the code behave correctly and build without warning. Signed-off-by: Arnd Bergmann Fixes: 84e0c4e5e2c4 ("spi: add loopback test driver to allow for spi_master regression tests") --- The warning is hidden in allmodconfig at the moment because we build that with -Os rather than -O2, which shows it. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 894616f687b0..cf4bb36bee25 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -761,6 +761,7 @@ static int spi_test_run_iter(struct spi_device *spi, test.iterate_transfer_mask = 1; /* count number of transfers with tx/rx_buf != NULL */ + rx_count = tx_count = 0; for (i = 0; i < test.transfer_count; i++) { if (test.transfers[i].tx_buf) tx_count++;