Re: [PATCH wpan-next 1/2] nl802154: cleanup invalid argument handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 30, 2015 at 11:47:11AM +0200, Alexander Aring wrote:
> This patch cleanups the -EINVAL cases by combining them in one
> condition.
> 
> Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
> ---
>  net/ieee802154/nl802154.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> index f3c12f6..c01f4bb 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]);

ACK
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux