From patchwork Mon Jan 25 21:54:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101096 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1613346lbb; Mon, 25 Jan 2016 13:56:04 -0800 (PST) X-Received: by 10.98.32.156 with SMTP id m28mr29143652pfj.74.1453758964041; Mon, 25 Jan 2016 13:56:04 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si36279727pfi.234.2016.01.25.13.56.03; Mon, 25 Jan 2016 13:56:04 -0800 (PST) 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 S932268AbcAYV4B (ORCPT + 30 others); Mon, 25 Jan 2016 16:56:01 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:54468 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbcAYVz7 (ORCPT ); Mon, 25 Jan 2016 16:55:59 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MPMdk-1aSCpJ0soS-004Qbd; Mon, 25 Jan 2016 22:55:25 +0100 From: Arnd Bergmann To: Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Jiri Slaby , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] tty: nozomi: avoid a harmless gcc warning Date: Mon, 25 Jan 2016 22:54:56 +0100 Message-Id: <1453758918-3577213-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:5cP7czYoqvYQZpPOMQ9a3PJJTHnBIZl9fZtAQiTuggCVd+G9M3T DOabUqJj9rVr+P5lSmC2gEO3582sgDHKQxV5f9TCf1uVdDvucsBLPaZQi40iwIGVm8zKBys Nybyi8umnvjKJDKBqP541gUh7yafrFFToiA2eAzEl+tKyLxHhCbPbJYU7vw2D5kpx8HgeBh 0HuTPQyj1aep+VyRaT9Hg== X-UI-Out-Filterresults: notjunk:1; V01:K0:7OUAcugPEgU=:kfrE32k+6PWwT9xilFzlZ1 Xats+KqGryH6ZkUgoSaO653y/PCswXoWGLnjU2zqBYw+od541Z+sC7Cq7YipIHOxOIFFXis/y KwDGHALbI6RC/SAURoCM/MP119pbEq1XjBxVLVQHvVSIdQIbGphSKTK64Ketv/HsY8NTKGsgP L1BhJtvIhRpbiyvnyfavBsynqZxMveuVw8IvIjaSlsvI+DEFgeBFiAcmsLsT00DCPvPkbyrSB u6huNWwrXBy0Qdq3RE9bXaxnd01zo4C7/ODFSjelaQg5bU1fnMq/9EFF+RU6O2e8q9Z5EzbvQ f3s31OP4coKKiRUNWG3A+zHnlolsjozDfQnUNI93LzY8U03WMMf1PuTvvJEW4O13vwJTvM5us w5RGozzWB+WqCJzG5AwdczCDbbid0P8skkMq+yda22RmybJ//L+1ck95QEpsFT1sMqDuOJQE2 iO7nb66ru/VTdFlNEcQduJKZwt7e/JfaDyzgEtaxfbnk8riLUkaTqT2D7S/ryDVS3hLtEmT3R B2CzB6LBtr00VVlmGyB5j0NoW3QvynzC79AS/ByE/72o91s+aFwZ+A/DMBRN1HNRTRHG765U1 8Xwq+Poi1E9gABNPfweKamEWmMCPhGzzvv/yTCR+Wnj4Jh6o/6eYeTqqzXGrfLT71FP2IBVu0 u4Apc/GWZwMdwWV7QQLGel996ystTRtfB+palT1ae/fsE7X8jJUi3qr2wQ0ClCFSjcLU= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nozomi wireless data driver has its own helper function to transfer data from a FIFO, doing an extra byte swap on big-endian architectures, presumably to bring the data back into byte-serial order after readw() or readl() perform their implicit byteswap. This helper function is used in the receive_data() function to first read the length into a 32-bit variable, which causes a compile-time warning: drivers/tty/nozomi.c: In function 'receive_data': drivers/tty/nozomi.c:857:9: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized] The problem is that gcc is unsure whether the data was actually read or not. We know that it is at this point, so we can replace it with a single readl() to shut up that warning. I am leaving the byteswap in there, to preserve the existing behavior, even though this seems fishy: Reading the length of the data into a cpu-endian variable should normally not use a second byteswap on big-endian systems, unless the hardware is aware of the CPU endianess. There appears to be a lot more confusion about endianess in this driver, so it probably has not worked on big-endian systems in a long time, if ever, and I have no way to test it. It's well possible that this driver has not been used by anyone in a while, the last patch that looks like it was tested on the hardware is from 2008. Signed-off-by: Arnd Bergmann --- drivers/tty/nozomi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 80f9de907563..5cc80b80c82b 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -823,7 +823,7 @@ static int receive_data(enum port_type index, struct nozomi *dc) struct tty_struct *tty = tty_port_tty_get(&port->port); int i, ret; - read_mem32((u32 *) &size, addr, 4); + size = __le32_to_cpu(readl(addr)); /* DBG1( "%d bytes port: %d", size, index); */ if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {