Commit 0cf0879a authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

nl802154: cleanup invalid argument handling

This patch cleanups the -EINVAL cases by combining them in one
condition.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 43b79209
...@@ -668,10 +668,8 @@ static int nl802154_set_pan_id(struct sk_buff *skb, struct genl_info *info) ...@@ -668,10 +668,8 @@ static int nl802154_set_pan_id(struct sk_buff *skb, struct genl_info *info)
return -EBUSY; return -EBUSY;
/* don't change address fields on monitor */ /* don't change address fields on monitor */
if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
return -EINVAL; !info->attrs[NL802154_ATTR_PAN_ID])
if (!info->attrs[NL802154_ATTR_PAN_ID])
return -EINVAL; return -EINVAL;
pan_id = nla_get_le16(info->attrs[NL802154_ATTR_PAN_ID]); pan_id = nla_get_le16(info->attrs[NL802154_ATTR_PAN_ID]);
...@@ -691,10 +689,8 @@ static int nl802154_set_short_addr(struct sk_buff *skb, struct genl_info *info) ...@@ -691,10 +689,8 @@ static int nl802154_set_short_addr(struct sk_buff *skb, struct genl_info *info)
return -EBUSY; return -EBUSY;
/* don't change address fields on monitor */ /* don't change address fields on monitor */
if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
return -EINVAL; !info->attrs[NL802154_ATTR_SHORT_ADDR])
if (!info->attrs[NL802154_ATTR_SHORT_ADDR])
return -EINVAL; return -EINVAL;
short_addr = nla_get_le16(info->attrs[NL802154_ATTR_SHORT_ADDR]); short_addr = nla_get_le16(info->attrs[NL802154_ATTR_SHORT_ADDR]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment