From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753425AbdGUM3q (ORCPT ); Fri, 21 Jul 2017 08:29:46 -0400 Received: from ni.piap.pl ([195.187.100.4]:33286 "EHLO ni.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752152AbdGUM3o (ORCPT ); Fri, 21 Jul 2017 08:29:44 -0400 X-Greylist: delayed 467 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Jul 2017 08:29:44 EDT From: khalasa@piap.pl (Krzysztof =?utf-8?Q?Ha=C5=82asa?=) To: Arnd Bergmann Cc: Imre Kaloz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/12] ARM: ixp4xx: fix ioport_unmap definition References: <20170720154616.3250481-1-arnd@arndb.de> <20170720154616.3250481-2-arnd@arndb.de> Date: Fri, 21 Jul 2017 14:21:53 +0200 In-Reply-To: <20170720154616.3250481-2-arnd@arndb.de> (Arnd Bergmann's message of "Thu, 20 Jul 2017 17:45:55 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 115008 [Jul 21 2017] X-KLMS-AntiSpam-Version: 5.7.49.0 X-KLMS-AntiSpam-Envelope-From: khalasa@piap.pl X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Info: LuaCore: 35 35 2983e55097185dfbbb2b94369d95e128c7badfb4, {Headers: Track_sender_matches_from}, Auth:dkim=none X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, 2017/07/19 10:57:39 X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.721, bases: 2017/07/21 03:26:00 #10148061 X-KLMS-AntiVirus-Status: Clean, skipped Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > An empty macro definition can cause unexpected behavior, in > case of the ixp4xx ioport_unmap, we get two warnings: > > drivers/net/wireless/marvell/libertas/if_cs.c: In function 'if_cs_release': > drivers/net/wireless/marvell/libertas/if_cs.c:826:3: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] > ioport_unmap(card->iobase); > drivers/vfio/pci/vfio_pci_rdwr.c: In function 'vfio_pci_vga_rw': > drivers/vfio/pci/vfio_pci_rdwr.c:230:15: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses] > is_ioport ? ioport_unmap(iomem) : iounmap(iomem); > > This uses an inline function to define the macro in a safer way. > > Signed-off-by: Arnd Bergmann > --- > arch/arm/mach-ixp4xx/include/mach/io.h | 11 +++++++++-- Acked-by: Krzysztof Halasa In fact, the old code contained another bug (missing parentheses): > --- a/arch/arm/mach-ixp4xx/include/mach/io.h > > -#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET)) ^^^^ -- Krzysztof Halasa Industrial Research Institute for Automation and Measurements PIAP Al. Jerozolimskie 202, 02-486 Warsaw, Poland