summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 15:44:37 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 05:44:41 -0400
commit0cf0879acdbeff695963d78940b89497803ae55c (patch)
treeabb1e0a7e62169e235414ca17f2540d81d402fd7 /net/ieee802154
parent43b79209b5be533173eea08535558cf517b334ca (diff)
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/ieee802154')
-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)
668 return -EBUSY; 668 return -EBUSY;
669 669
670 /* don't change address fields on monitor */ 670 /* don't change address fields on monitor */
671 if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) 671 if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
672 return -EINVAL; 672 !info->attrs[NL802154_ATTR_PAN_ID])
673
674 if (!info->attrs[NL802154_ATTR_PAN_ID])
675 return -EINVAL; 673 return -EINVAL;
676 674
677 pan_id = nla_get_le16(info->attrs[NL802154_ATTR_PAN_ID]); 675 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 return -EBUSY; 689 return -EBUSY;
692 690
693 /* don't change address fields on monitor */ 691 /* don't change address fields on monitor */
694 if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) 692 if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR ||
695 return -EINVAL; 693 !info->attrs[NL802154_ATTR_SHORT_ADDR])
696
697 if (!info->attrs[NL802154_ATTR_SHORT_ADDR])
698 return -EINVAL; 694 return -EINVAL;
699 695
700 short_addr = nla_get_le16(info->attrs[NL802154_ATTR_SHORT_ADDR]); 696 short_addr = nla_get_le16(info->attrs[NL802154_ATTR_SHORT_ADDR]);