[PATCH] staging: wlan-ng: collect return status without variable

Dan Carpenter dan.carpenter at oracle.com
Fri May 10 10:57:54 UTC 2019


On Fri, May 10, 2019 at 08:09:00AM +0530, Hariprasad Kelam wrote:
> diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
> index 8a862f7..5dad5ac 100644
> --- a/drivers/staging/wlan-ng/cfg80211.c
> +++ b/drivers/staging/wlan-ng/cfg80211.c
> @@ -231,17 +231,12 @@ static int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev,
>  {
>  	struct wlandevice *wlandev = dev->ml_priv;
>  
> -	int err = 0;
> -	int result = 0;
> -
> -	result = prism2_domibset_uint32(wlandev,
> -		DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> -		key_index);
> -
> -	if (result)
> -		err = -EFAULT;
> -
> -	return err;
> +	if (prism2_domibset_uint32(wlandev,
> +				   DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> +				   key_index))
> +		return -EFAULT;
> +	else
> +		return 0;

We should just preserve the error codes from prism2_domibset_uint32().

	return prism2_domibset_uint32(dev->ml_priv,
				DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
				key_index);

regards,
dan carpenter



More information about the devel mailing list