summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 21:44:37 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 11:44:41 +0200
commit0cf0879acdbeff695963d78940b89497803ae55c (patch)
treeabb1e0a7e62169e235414ca17f2540d81d402fd7 /net
parent43b79209b5be533173eea08535558cf517b334ca (diff)
downloadlinux-0cf0879acdbeff695963d78940b89497803ae55c.tar.gz
linux-0cf0879acdbeff695963d78940b89497803ae55c.tar.bz2
linux-0cf0879acdbeff695963d78940b89497803ae55c.zip
nl802154: cleanup invalid argument handling
This patch cleanups the -EINVAL cases by combining them in one condition. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/nl802154.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index f3c12f6a4a39..c01f4bbe7c7c 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -668,10 +668,8 @@ static int nl802154_set_pan_id(struct sk_buff *skb, struct genl_info *info)
return -EBUSY;
/* don't change address fields on monitor */
- if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
- return -EINVAL;
-
- if (!info->attrs[NL802154_ATTR_PAN_ID])
+ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
+ !info->attrs[NL802154_ATTR_PAN_ID])
return -EINVAL;
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)
return -EBUSY;
/* don't change address fields on monitor */
- if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
- return -EINVAL;
-
- if (!info->attrs[NL802154_ATTR_SHORT_ADDR])
+ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
+ !info->attrs[NL802154_ATTR_SHORT_ADDR])
return -EINVAL;
short_addr = nla_get_le16(info->attrs[NL802154_ATTR_SHORT_ADDR]);