Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Feb 2019 09:30:53 -0800 (PST)
From:      "Rodney W. Grimes" <freebsd@pdx.rh.CN85.dnsmgr.net>
To:        Andriy Voskoboinyk <avos@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r343682 - head/sys/dev/wtap
Message-ID:  <201902021730.x12HUrcO028481@pdx.rh.CN85.dnsmgr.net>
In-Reply-To: <201902021615.x12GFkmQ000435@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[ Charset UTF-8 unsupported, converting... ]
> Author: avos
> Date: Sat Feb  2 16:15:46 2019
> New Revision: 343682
> URL: https://svnweb.freebsd.org/changeset/base/343682
> 
> Log:
>   sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
>   drop unneeded cast.
>   
>   MFC after:	3 days
> 
> Modified:
>   head/sys/dev/wtap/if_wtap.c
> 
> Modified: head/sys/dev/wtap/if_wtap.c
> ==============================================================================
> --- head/sys/dev/wtap/if_wtap.c	Sat Feb  2 16:07:56 2019	(r343681)
> +++ head/sys/dev/wtap/if_wtap.c	Sat Feb  2 16:15:46 2019	(r343682)
> @@ -373,7 +373,7 @@ wtap_vap_delete(struct ieee80211vap *vap)
>  	destroy_dev(avp->av_dev);
>  	callout_stop(&avp->av_swba);
>  	ieee80211_vap_detach(vap);
> -	free((struct wtap_vap*) vap, M_80211_VAP);
> +	free(avp, M_80211_VAP);
>  }
>  
>  static void
> @@ -602,6 +602,8 @@ wtap_node_alloc(struct ieee80211vap *vap, const uint8_
>  
>  	ni = malloc(sizeof(struct ieee80211_node), M_80211_NODE,
>  	    M_NOWAIT|M_ZERO);
> +	if (ni == NULL)
> +		return (NULL);
>  
>  	ni->ni_txrate = 130;
>  	return ni;

Um, this simplifies to and preserves single return:

	if (ni != NULL)
		ni->ni_txrate = 130;
	return ni;


-- 
Rod Grimes                                                 rgrimes@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902021730.x12HUrcO028481>