Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66abd43a authored by Karthik Reddy Katta's avatar Karthik Reddy Katta
Browse files

hal: spkr_prot: Fix uninitialized variable access

Assign default values to local variables
which might be might be used uninitialized in
several functions.

Change-Id: I264fbbe9c10345da8eea21ac9298963a69b1da26
CRs-Fixed: 1117388
parent 1181b299
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -684,6 +684,7 @@ static void* spkr_calibration_thread()
    char buf[32] = {0};
    int ret;

    memset(&protCfg, 0, sizeof(protCfg));
    /* If the value of this persist.spkr.cal.duration is 0
     * then it means it will take 30min to calibrate
     * and if the value is greater than zero then it would take
@@ -1049,9 +1050,9 @@ static void get_spkr_prot_ftm_param(char *param)
    struct audio_cal_sp_th_vi_param th_vi_cal_data;
    struct audio_cal_sp_ex_vi_param ex_vi_cal_data;
    int i;
    int ftm_status[SP_V2_NUM_MAX_SPKRS];
    double rdc[SP_V2_NUM_MAX_SPKRS], temp[SP_V2_NUM_MAX_SPKRS];
    double f[SP_V2_NUM_MAX_SPKRS], r[SP_V2_NUM_MAX_SPKRS], q[SP_V2_NUM_MAX_SPKRS];
    int ftm_status[SP_V2_NUM_MAX_SPKRS] = {0};
    double rdc[SP_V2_NUM_MAX_SPKRS] = {0}, temp[SP_V2_NUM_MAX_SPKRS] = {0};
    double f[SP_V2_NUM_MAX_SPKRS] = {0}, r[SP_V2_NUM_MAX_SPKRS] = {0}, q[SP_V2_NUM_MAX_SPKRS] = {0};

    int cal_fd = open("/dev/msm_audio_cal",O_RDWR | O_NONBLOCK);
    if (cal_fd < 0) {