From patchwork Mon May 30 13:50:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102295 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1417584qge; Mon, 30 May 2016 06:51:00 -0700 (PDT) X-Received: by 10.66.250.132 with SMTP id zc4mr47006870pac.130.1464616260585; Mon, 30 May 2016 06:51:00 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v80si36668646pfj.199.2016.05.30.06.51.00; Mon, 30 May 2016 06:51:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161264AbcE3Nu5 (ORCPT + 30 others); Mon, 30 May 2016 09:50:57 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:50104 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754616AbcE3Nu4 (ORCPT ); Mon, 30 May 2016 09:50:56 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MPXwP-1bC4Q52aMz-004lSv; Mon, 30 May 2016 15:50:24 +0200 From: Arnd Bergmann To: Lars-Peter Clausen , Greg Kroah-Hartman Cc: Arnd Bergmann , Geert Uytterhoeven , Ksenija Stanojevic , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Ioana Ciornei , Daniel Baluta , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: iio: fix ad7606_spi regression Date: Mon, 30 May 2016 15:50:24 +0200 Message-Id: <1464616249-3523805-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:awxJeKRJbTO7V4X7GMKrHlmYZRUDcnF9qpkTDo0bfBTAL6CbV74 U5VDP6LxqqHZqdThV8TIwVFephNzoRX9ocy1EC5AfzDquoBFqz5AIbkPHvq1BZNbWM7m7TE KiIq99P77qUWmU/NbbP7/DDmJuvNYVhyqX4D3V8lOVdpcc1jc4MyinQuMQP/20ywCJsGn/p +UkAILHFV95e+xvCOkPUA== X-UI-Out-Filterresults: notjunk:1; V01:K0:3P5DrkEh2r0=:KszoAfsibliPnsd7fCFJgB wvwMKpLIIXxr/kk6eoV7S2nvKs/ZExqfl4GsUHKYWGhkAt6Gbr7uGGlctCLfHbKpQ7Dy+iTSD YRmhdB1R8ehOmjNZF/BU84jRjJUfBuXe4gGV7wd6d0Gb61ffdGdw9iu6roaUZ9i3Uu+JFc1Cp epti5+h0yLRagwy0qmDPMhWfBa9MF276mkv3TQn50O8lYLEch1St1kWhQj3sBCkaUiIntLicE Nu64UMWw2v67sHM7g5DbQZjcma7Yn2P5eaEp4bYit1IABRpAWdG9NtToSMEAmbma2ZDVweZhZ CvEj7e/kQbvNQ1/XgTw4fNoY6egv3HX2Js4Hd4wgZDEB0uffrU7AFHzkwuBNORH5Y+4e4y3fV 0cIX9kJ2BrnFBVTU/tWDWCUYMHe8Oo7oFkpml73ghewauvFig306P0jyyW2CF16SWMweE02lu L7N4RWK2zuZYA7JCTryBnIeZ0S23Lgt0dfQSK/KrY+4BqUYS6FFUgFxlgXAs9jILv6DBQ4e0h fcmZB9WQLoLaxbI0xEseB5Q+ILl7btMFpM4M5k3y5cC9papD3yCMgW9s3IX7IIFCR86nEKM/b /iVCRFHNqPIy/b3ZOIn4kd9QTBymyRPLcxUj5uLg7d41Lthd0IH1HT0YB6Wca97QLPVrIIEIR 0CXqfwfISzuNryMsDZknO9zBgtFoPw7s+VOtzd9aGCVizUakVuOPfZeRG0E5TjokDx+oI+ADC eE4YGkX+5mY7b5KC Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As pointed out by Geert Uytterhoeven, the patch was incorrect and breaks the driver, which was fortunately pointed out by this gcc warning: drivers/staging/iio/adc/ad7606_spi.c: In function ‘ad7606_spi_read_block’: drivers/staging/iio/adc/ad7606_spi.c:34: warning: ‘data’ is used uninitialized in this function The effect of the patch is that the data is copied into a random memory location (from the uninitialized pointer) instead of being byteswapped in place. This adds the initialization for the 'data' variable back to restore the original behavior. Cc: Geert Uytterhoeven Cc: Ksenija Stanojevic Fixes: 87787e5ef727 ("Staging: iio: Fix sparse endian warning") Signed-off-by: Arnd Bergmann --- drivers/staging/iio/adc/ad7606_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index 825da0769936..9587fa86dc69 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c @@ -21,7 +21,7 @@ static int ad7606_spi_read_block(struct device *dev, { struct spi_device *spi = to_spi_device(dev); int i, ret; - unsigned short *data; + unsigned short *data = buf; __be16 *bdata = buf; ret = spi_read(spi, buf, count * 2);