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: 8028051 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D061BEEE5 for ; Wed, 13 Jan 2016 20:52:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 412FB204E0 for ; Wed, 13 Jan 2016 20:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 717AD204D9 for ; Wed, 13 Jan 2016 20:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758721AbcAMUwC (ORCPT ); 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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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") Acked-by: Geert Uytterhoeven --- 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++;