On Monday, 31 December 2018 12.59.36 CET Linus Lüssing wrote: [...]
static int batadv_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) {
- struct batadv_priv *bat_priv;
- struct batadv_hard_iface *hard_iface;
- struct batadv_priv *bat_priv = NULL;
- int ret;
- if (WARN_ON(ops->internal_flags & BATADV_FLAG_NEED_HARDIF))
return -EINVAL;
- if (WARN_ON((ops->internal_flags & BATADV_FLAG_NEED_HARDIF) &&
(~ops->internal_flags & BATADV_FLAG_NEED_MESH)))
return -EINVAL;
Seems like the second part is unreachable code. If BATADV_FLAG_NEED_HARDIF is set then the function returns with the first if-clause already.
Looks like I've incorrectly splitted the patch at this position. Makes more sense when you check the next patch.
So the first check should be removed from this patch to make it less confusing.
Btw. thanks for the spelling/grammar fixes.
Kind regards, Sven