Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1693664
| From | khalasa@piap.pl (Krzysztof Hałasa) |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 01/12] ARM: ixp4xx: fix ioport_unmap definition |
| Date | 2017-07-21 14:30 +0200 |
| Message-ID | <u5Fea-4LB-23@gated-at.bofh.it> (permalink) |
| References | <u5lSb-XA-33@gated-at.bofh.it> <u5lSb-XA-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> ---
> arch/arm/mach-ixp4xx/include/mach/io.h | 11 +++++++++--
Acked-by: Krzysztof Halasa <khalasa@piap.pl>
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 01/12] ARM: ixp4xx: fix ioport_unmap definition Arnd Bergmann <arnd@arndb.de> - 2017-07-20 17:50 +0200 Re: [PATCH 01/12] ARM: ixp4xx: fix ioport_unmap definition khalasa@piap.pl (Krzysztof Hałasa) - 2017-07-21 14:30 +0200
csiph-web