Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1318990 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-01-27 15:10 +0100 |
| Last post | 2016-01-27 16:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use Arnd Bergmann <arnd@arndb.de> - 2016-01-27 15:10 +0100
Re: [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use "Maciej W. Rozycki" <macro@linux-mips.org> - 2016-01-27 16:20 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-01-27 15:10 +0100 |
| Subject | [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use |
| Message-ID | <qVyXi-4EQ-35@gated-at.bofh.it> |
The defxx driver can be configured for different kinds of buses,
and appears to be handling this correctly, but the compiler cannot
see how it always initializes the bar_start and bar_length
fields it uses depending on the configured bus, so we get a warning
with recent gcc versions:
fddi/defxx.c: In function 'dfx_pci_unregister':
fddi/defxx.c:3726:3: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
release_mem_region(bar_start[0], bar_len[0]);
fddi/defxx.c:3701:18: note: 'bar_len' was declared here
resource_size_t bar_len[3]; /* resource lengths */
fddi/defxx.c:3726:3: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized]
release_mem_region(bar_start[0], bar_len[0]);
fddi/defxx.c:3700:18: note: 'bar_start' was declared here
resource_size_t bar_start[3]; /* pointers to ports */
^
fddi/defxx.c: In function 'dfx_pci_register':
fddi/defxx.c:617:18: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
bp->base.mem = ioremap_nocache(bar_start[0], bar_len[0]);
fddi/defxx.c:537:18: note: 'bar_len' was declared here
resource_size_t bar_len[3]; /* resource length */
fddi/defxx.c:1125:2: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized]
pr_info("%s: %s at %s addr = 0x%llx, IRQ = %d, Hardware addr = %pMF\n",
fddi/defxx.c:536:18: note: 'bar_start' was declared here
resource_size_t bar_start[3]; /* pointers to ports */
This adds code to ensure that the BAR values are initialized
even in the impossible case when a device gets probed that
does not belong to any bus. This shuts up the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/fddi/defxx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index 7f975a2c8990..e7cdd1226d39 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -484,6 +484,11 @@ static void dfx_get_bars(struct device *bdev,
bar_start[2] = bar_start[1] = 0;
bar_len[2] = bar_len[1] = 0;
}
+ if (!(dfx_bus_pci || dfx_bus_eisa || dfx_bus_tc)) {
+ dev_err(bdev, "invalid bus configuration\n");
+ bar_start[2] = bar_start[1] = bar_start[0] = 0;
+ bar_len[2] = bar_len[1] = bar_len[0] = 0;
+ }
}
static const struct net_device_ops dfx_netdev_ops = {
--
2.7.0
[toc] | [next] | [standalone]
| From | "Maciej W. Rozycki" <macro@linux-mips.org> |
|---|---|
| Date | 2016-01-27 16:20 +0100 |
| Subject | Re: [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use |
| Message-ID | <qVA30-5qa-7@gated-at.bofh.it> |
| In reply to | #1318990 |
On Wed, 27 Jan 2016, Arnd Bergmann wrote:
> This adds code to ensure that the BAR values are initialized
> even in the impossible case when a device gets probed that
> does not belong to any bus. This shuts up the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/fddi/defxx.c | 5 +++++
> 1 file changed, 5 insertions(+)
NAK, fixed already, commit 62f2aaabcf41 ("defxx: fix build warning").
Thanks for looking into this problem though, always welcome!
Maciej
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web