Marvell Wifi driver: NULL check before dereferencing

CID 5911.
This commit is contained in:
Philippe Saint-Pierre
2011-12-29 23:27:44 -05:00
parent 258c1019f1
commit c7199625ef
@@ -1451,6 +1451,7 @@ mwl_hal_bastream_alloc(struct mwl_hal_vap *vap, int ba_policy,
} }
sp = &mh->mh_streams[s]; sp = &mh->mh_streams[s];
mh->mh_bastreams &= ~(1<<s); mh->mh_bastreams &= ~(1<<s);
if (sp != NULL) {
sp->public.data[0] = a1; sp->public.data[0] = a1;
sp->public.data[1] = a2; sp->public.data[1] = a2;
IEEE80211_ADDR_COPY(sp->macaddr, Macaddr); IEEE80211_ADDR_COPY(sp->macaddr, Macaddr);
@@ -1459,7 +1460,11 @@ mwl_hal_bastream_alloc(struct mwl_hal_vap *vap, int ba_policy,
sp->setup = 0; sp->setup = 0;
sp->ba_policy = ba_policy; sp->ba_policy = ba_policy;
MWL_HAL_UNLOCK(mh); MWL_HAL_UNLOCK(mh);
return sp != NULL ? &sp->public : NULL; return &sp->public;
} else {
MWL_HAL_UNLOCK(mh);
return NULL;
}
} }
const MWL_HAL_BASTREAM * const MWL_HAL_BASTREAM *