On Wed, May 29, 2013 at 12:39:33AM +0800, Marek Lindner wrote:
On Tuesday, May 28, 2013 23:40:54 Simon Wunderlich wrote:
You can safe an indendation below if you return -1 immediately here if the statement above is false. Also multiple statements might be better for readability and later changes, e.g.
if (!atomic_read(&bat_priv->mcast_group_awareness)) return 1;
if (atomic_read(&bat_priv->mcast.num_non_aware)) return 1;
if (ntohs(ethhdr->h_proto) != ETH_P_IPV6) return 1;
A quick hint from my end: The kernel maintainer don't like code that returns "random" values like 1/0/-1. Either use bool or meaningful defines instead of raw numbers.
Very good suggestion. I think you can define an enum for this. It will make the code much easier to understand.
Cheers,