neighbour: Convert if statment in the function, neigh_add_timer to a WARN_ON
Subsystems (2)
Quoted 16 lines · Nicholas Krause
This converts the if statement for dumping the stack into a
WARN_ONin order to make this function's debugging check simpler and have a cleaner output when this condition occurs inside this function for when bugs related to adding a duplicate neighbour table timer arise.Signed-off-by Nicholas Krause <[email protected]>--- net/core/neighbour.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)net/core/neighbour.c +0
-0
net/core/neighbour.c static int neigh_forced_gc(struct neigh_table *tbl) · line 169
Quoted 10 lines
net/core/neighbour.c +1
-5@@ -165,11 +165,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)static void neigh_add_timer (struct neighbour *n,unsigned long when) {neigh_hold (n); -if (unlikely (mod_timer (&n->timer, when))) { -printk ("NEIGH: BUG, double timer add, state is %x\n" , - n->nud_state); -dump_stack (); - } +WARN_ON (unlikely (mod_timer (&n->timer, when))); }
NACK, please do not use WARN_ON for things with side effects.
--yoshfuji
Quoted 21 lines · YOSHIFUJI Hideaki/吉藤英明
Quoted 20 lines · Nicholas Krause
This converts the if statement for dumping the stack into a
WARN_ONin order to make this function's debugging check simpler and have a cleaner output when this condition occurs inside this function for when bugs related to adding a duplicate neighbour table timer arise.Signed-off-by Nicholas Krause <[email protected]>--- net/core/neighbour.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)net/core/neighbour.c +0
-1@@ -165,11 +165,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)static void neigh_add_timer (struct neighbour *n,unsigned long when) {neigh_hold (n); -if (unlikely (mod_timer (&n->timer, when))) {
Quoted 8 lines
net/core/neighbour.c static int neigh_forced_gc(struct neigh_table *tbl) · line 169
Quoted 6 lines
net/core/neighbour.c +1
-4-printk ("NEIGH: BUG, double timer add, state is %x\n" , - n->nud_state); -dump_stack (); - } +WARN_ON (unlikely (mod_timer (&n->timer, when))); }NACK, please do not use
WARN_ONfor things with side effects.
Just:
int ret = mod_timer(...);WARN_ON(ret);
...