fix a warning on drivers/infiniband/hw/nes/nes_cm.c:862:
PATCH 1/1 fix a warning on drivers/infiniband/hw/nes/nes_cm.c:862:
Fix this warning:drivers/infiniband/hw/nes/nes_cm.c:862: warning: unused variable ‘tmp_addr’
the 'tmp_addr' is defined for debug, so it should be defined in CONFIG_INFINIBAND_NES_DEBUG
Quoted 1 line
From
5f67884bcda5450807dcd080378d829628e4db1cMon Sep 17 00:00:00 2001
From: Zhenwen Xu <[email protected]>
Date: Sun, 12 Apr 2009 20:12:18 +0800
Subject: [PATCH] fix a warning on drivers/infiniband/hw/nes/nes_cm.c:862:
--- drivers/infiniband/hw/nes/nes_cm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/infiniband/hw/nes/nes_cm.c +2 -1
@@ -854,8 +854,9 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, {unsigned long flags;struct nes_cm_listener *listen_node; +#ifdef CONFIG_INFINIBAND_NES_DEBUG __be32 tmp_addr =cpu_to_be32 (dst_addr); - +#endif /* walk list and find cm_node associated with this session ID */ spin_lock_irqsave (&cm_core->listen_list_lock, flags);list_for_each_entry (listen_node, &cm_core->listen_list.list, list) {
Signature · 7 lines
1.5.6.5 -- --------------------------------- Zhenwen Xu - Open and Free Home Page: http://zhwen.org My Studio: http://dim4.cn
Quoted 22 lines · On Sun, 12 Apr 2009 20:23:17 +0800 Zhenwen Xu <[email protected]> wrote:
Fix this warning:
drivers/infiniband/hw/nes/nes_cm.c:862: warning: unused variable___tmp_addr___the '
tmp_addr' is defined for debug, so it should be defined inCONFIG_INFINIBAND_NES_DEBUGQuoted 1 line
From
5f67884bcda5450807dcd080378d829628e4db1cMon Sep 17 00:00:00 2001From: Zhenwen Xu <[email protected]>
Date: Sun, 12 Apr 2009 20:12:18 +0800
Subject: [PATCH] fix a warning ondrivers/infiniband/hw/nes/nes_cm.c:862:Signed-off-by Zhenwen Xu <[email protected]>--- drivers/infiniband/hw/nes/nes_cm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/infiniband/hw/nes/nes_cm.c +0
-0
drivers/infiniband/hw/nes/nes_cm.c static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, · line 862
Quoted 10 lines
drivers/infiniband/hw/nes/nes_cm.c +2
-1@@ -854,8 +854,9 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, {unsigned long flags;struct nes_cm_listener *listen_node; +#ifdef CONFIG_INFINIBAND_NES_DEBUG __be32 tmp_addr =cpu_to_be32 (dst_addr); - +#endif /* walk list and find cm_node associated with this session ID */ spin_lock_irqsave (&cm_core->listen_list_lock, flags);list_for_each_entry (listen_node, &cm_core->listen_list.list, list) {
eek, an ugly ifdef. And we can't just remove tmp_addr because printk(%p) wants to be passed an address rather than a value.
It'd be nice if we had a handy macro to squish the warning, like uninitialized_var.
As it happens, uninitialized_var() _does_ suppress the unused-var warning:
drivers/infiniband/hw/nes/nes_cm.c renamed from drivers/infiniband/hw/nes/nes_cm.c~drivers-infiniband-hw-nes-nes_cmc-fix-unused-var-warning-cleanup +2 -3
@@ -854,9 +854,8 @@ static struct nes_cm_listener *find_list {unsigned long flags;struct nes_cm_listener *listen_node; -#ifdef CONFIG_INFINIBAND_NES_DEBUG -__be32 tmp_addr =cpu_to_be32 (dst_addr); -#endif +__be32 uninitialized_var (tmp_addr ) =cpu_to_be32 (dst_addr); +/* walk list and find cm_node associated with this session ID */ spin_lock_irqsave (&cm_core->listen_list_lock, flags);list_for_each_entry (listen_node, &cm_core->listen_list.list, list) {
but that seems a bit abusive ;)
Quoted 60 lines · Andrew Morton
Quoted 22 lines · On Sun, 12 Apr 2009 20:23:17 +0800 Zhenwen Xu <[email protected]> wrote:
Fix this warning:
drivers/infiniband/hw/nes/nes_cm.c:862: warning: unused variable___tmp_addr___the '
tmp_addr' is defined for debug, so it should be defined inCONFIG_INFINIBAND_NES_DEBUGQuoted 1 line
From
5f67884bcda5450807dcd080378d829628e4db1cMon Sep 17 00:00:00 2001From: Zhenwen Xu <[email protected]>
Date: Sun, 12 Apr 2009 20:12:18 +0800
Subject: [PATCH] fix a warning ondrivers/infiniband/hw/nes/nes_cm.c:862:Signed-off-by Zhenwen Xu <[email protected]>--- drivers/infiniband/hw/nes/nes_cm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/infiniband/hw/nes/nes_cm.c +0
-0drivers/infiniband/hw/nes/nes_cm.c static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, · line 862
Quoted 10 lines
drivers/infiniband/hw/nes/nes_cm.c +2
-1@@ -854,8 +854,9 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, {unsigned long flags;struct nes_cm_listener *listen_node; +#ifdef CONFIG_INFINIBAND_NES_DEBUG __be32 tmp_addr =cpu_to_be32 (dst_addr); - +#endif /* walk list and find cm_node associated with this session ID */ spin_lock_irqsave (&cm_core->listen_list_lock, flags);list_for_each_entry (listen_node, &cm_core->listen_list.list, list) {eek, an ugly ifdef. And we can't just remove
tmp_addrbecause printk(%p) wants to be passed an address rather than a value.It'd be nice if we had a handy macro to squish the warning, like
uninitialized_var.As it happens,
uninitialized_var()_does_ suppress the unused-var warning:drivers/infiniband/hw/nes/nes_cm.c renamed from drivers/infiniband/hw/nes/nes_cm.c~drivers-infiniband-hw-nes-nes_cmc-fix-unused-var-warning-cleanup +2
-3@@ -854,9 +854,8 @@ static struct nes_cm_listener *find_list {unsigned long flags;struct nes_cm_listener *listen_node; -#ifdef CONFIG_INFINIBAND_NES_DEBUG -__be32 tmp_addr =cpu_to_be32 (dst_addr); -#endif +__be32 uninitialized_var (tmp_addr ) =cpu_to_be32 (dst_addr); +/* walk list and find cm_node associated with this session ID */ spin_lock_irqsave (&cm_core->listen_list_lock, flags);list_for_each_entry (listen_node, &cm_core->listen_list.list, list) {
Quoted 1 line
but that seems a bit abusive ;)
Thanks! I got.
Signature · 4 lines
--------------------------------- Zhenwen Xu - Open and Free Home Page: http://zhwen.org My Studio: http://dim4.cn