ieee80211_reconfig_nan_offload_de() may be called with no registered NAN functions. In this case, the restoration loop is skipped and res is returned without being initialized. Initialize res to zero so that reconfiguration succeeds when there are no NAN functions to restore. This also fixes the uninitialized variable warning from Smatch. Signed-off-by: Artemii Mashanov --- net/mac80211/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 69abd4e3f..155c4b66c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1772,7 +1772,7 @@ static int ieee80211_reconfig_nan_offload_de(struct ieee80211_sub_if_data *sdata) { struct cfg80211_nan_func *func, **funcs; - int res, id, i = 0; + int res = 0, id, i = 0; funcs = kzalloc_objs(*funcs, sdata->local->hw.max_nan_de_entries + 1); if (!funcs) -- 2.56.0