[ofa-general] Re: [PATCH] Fix wrong dbg output and gcc warning when INFINIBAND_NES_DEBUG is not set
Nikanth Karthikesan
knikanth at suse.de
Tue Apr 7 23:06:07 PDT 2009
On Wednesday 08 April 2009 11:10:10 Roland Dreier wrote:
> > The debug messaage wrongly prints the address of a local variable. Also
> > when INFINIBAND_NES_DEBUG is not set, gcc emits an unused variable
> > warning. Fix it.
> >
> > nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
> > - &tmp_addr, dst_port);
> > + cpu_to_be32(dst_addr), dst_port);
>
> My understanding is that %pI4 wants a pointer (as all %p formats do) --
> and every other use of %pI4 in the kernel that I looked as is passing a
> pointer to printk. Have you tested this patch with NES debug on? I
> would expect gcc to warn about passing a non-pointer to a %p format.
>
Yes, I was little hasty. Here is the corrected patch. Replaced %p with %x.
Thanks
Nikanth
The debug messaage wrongly prints the address of a local variable. Also when
INFINIBAND_NES_DEBUG is not set, gcc emits an unused variable warning. Fix it.
Signed-off-by: Nikanth Karthikesan <knikanth at suse.de>
---
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 5242515..14ffada 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -859,7 +859,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
{
unsigned long flags;
struct nes_cm_listener *listen_node;
- __be32 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);
@@ -876,8 +875,8 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
}
spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
- nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
- &tmp_addr, dst_port);
+ nes_debug(NES_DBG_CM, "Unable to find listener for %xI4:%x\n",
+ cpu_to_be32(dst_addr), dst_port);
/* no listener */
return NULL;
More information about the general
mailing list