fix tfa NULL ptr memory exception

For "NXP Volume" and "NXP mode" mixer, we need
to increase nr_controls.

Change-Id: I93e8a8d62908d8c8681fa10ff7efc3e96922b996
Signed-off-by: guoyf2 <guoyf2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1276325
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yunfei Guo <guoyf2@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Jianguo Liu <liujg6@motorola.com>
Reviewed-by: Wanlong Zhou <zhouwl@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
guoyf2 2018-11-30 17:56:53 +08:00 • committed by Yunfei Guo
commit b0219ff89b

View file

@ -1684,7 +1684,9 @@ static int tfa98xx_create_controls(struct tfa98xx *tfa98xx)
#ifdef TFA9874_NONDSP_STEREO
nr_controls += 1; /* for TFA_CHIP_SELECTOR */
nr_controls += 1; /* for NXP Volume */
#endif
nr_controls += 1; /* for NXP Mode */
/* allocate the tfa98xx_controls base on the nr of profiles */
nprof = tfa_cnt_get_dev_nprof(tfa98xx->tfa);
@ -1695,7 +1697,7 @@ static int tfa98xx_create_controls(struct tfa98xx *tfa98xx)
tfa98xx_controls = devm_kzalloc(tfa98xx->codec->dev,
nr_controls * sizeof(tfa98xx_controls[0]), GFP_KERNEL);
if (!tfa98xx_controls)
if (!tfa98xx_controls)
return -ENOMEM;
/* Create a mixer item for selecting the active profile */