From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932264AbcAYV4B (ORCPT ); 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 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 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(-) 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)) { -- 2.7.0