On Sat, Mar 30, 2013 at 11:01:29PM +0800, Marek Lindner wrote:
On Saturday, March 30, 2013 22:49:27 Antonio Quartulli wrote:
@@ -669,7 +669,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && tmp_neigh_node->if_incoming == if_incoming && atomic_inc_not_zero(&tmp_neigh_node->refcount)) {
if (neigh_node)
if (WARN(neigh_node, "too many matching
neigh_nodes") batadv_neigh_node_free_ref(neigh_node); neigh_node = tmp_neigh_node; continue;
I wasn't aware one could throw the warning right in the if-statement but for the sake of readability, please don't do that.
We already do that in hard-interface.c:92 and WARN() has been designed to return the value of the condition passed as argument (http://lingrok.org/xref/linux-net-next/include/asm-generic/bug.h#94).
There are many places in the kernel were this is done the same way. Actually this "connects" the warning to the action taken into the if block:
if "we are in trouble" do this to repair.
Cheers,