From: Johannes Berg Date: Wed, 10 Jun 2015 17:18:55 +0000 (+0300) Subject: mac80211: allow passing NULL to ieee80211_vif_to_wdev() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6513e98e05ccb8eca77adaf93beae44aa7bf4a45;p=linux-beck.git mac80211: allow passing NULL to ieee80211_vif_to_wdev() Simply return NULL in this case, instead of crashing. This can simplify callers that would otherwise have to check for this explicitly. Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 7fb2c7bacc8c..89e089c452c1 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -703,7 +703,12 @@ EXPORT_SYMBOL_GPL(wdev_to_ieee80211_vif); struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif) { - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); + struct ieee80211_sub_if_data *sdata; + + if (!vif) + return NULL; + + sdata = vif_to_sdata(vif); if (!ieee80211_sdata_running(sdata) || !(sdata->flags & IEEE80211_SDATA_IN_DRIVER))