Merge "BTFMSLIM: Free memory during error while port open" into bt-kernel.lnx.1.0

This commit is contained in:
CNSS_WLAN Service
2022-05-04 15:55:37 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -180,9 +180,13 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
if (ret == 0) if (ret == 0)
btfm_num_ports_open++; btfm_num_ports_open++;
error:
BTFMSLIM_INFO("btfm_num_ports_open: %d", btfm_num_ports_open); BTFMSLIM_INFO("btfm_num_ports_open: %d", btfm_num_ports_open);
return ret;
error:
BTFMSLIM_INFO("error %d while opening port, btfm_num_ports_open: %d",
ret, btfm_num_ports_open);
kfree(chan->dai.sconfig.chs); kfree(chan->dai.sconfig.chs);
chan->dai.sconfig.chs = NULL;
return ret; return ret;
} }
@@ -221,10 +225,14 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
} }
} }
ch->dai.sconfig.port_mask = 0; ch->dai.sconfig.port_mask = 0;
kfree(ch->dai.sconfig.chs); if (ch->dai.sconfig.chs != NULL)
kfree(ch->dai.sconfig.chs);
if (btfm_num_ports_open > 0) if (btfm_num_ports_open > 0)
btfm_num_ports_open--; btfm_num_ports_open--;
ch->dai.sruntime = NULL;
BTFMSLIM_INFO("btfm_num_ports_open: %d", btfm_num_ports_open); BTFMSLIM_INFO("btfm_num_ports_open: %d", btfm_num_ports_open);
return ret; return ret;
} }