hal: add checks for calibration buffer allocation failures
add check for calibration buffer allocations failures and enhance debug messages in the calibration update funtions. Change-Id: I08c48f57c4fe747af8c19d12c986a5b9279bca03
This commit is contained in:
parent
397d63698f
commit
04ab3d3c9e
|
@ -861,10 +861,16 @@ static int send_codec_cal(acdb_loader_get_calibration_t acdb_loader_get_calibrat
|
|||
}
|
||||
calib.get_size = 0;
|
||||
calib.buff = malloc(calib.buff_size);
|
||||
if(calib.buff == NULL) {
|
||||
ALOGE("%s mem allocation for %d bytes for %s failed\n"
|
||||
, __func__, calib.buff_size, cal_name_info[type]);
|
||||
return -1;
|
||||
}
|
||||
ret = acdb_loader_get_calibration(cal_name_info[type],
|
||||
sizeof(struct param_data), &calib);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s get_calibration failed\n", __func__);
|
||||
ALOGE("%s get_calibration failed type=%s calib.size=%d\n"
|
||||
, __func__, cal_name_info[type], codec_buffer.size);
|
||||
free(calib.buff);
|
||||
return ret;
|
||||
}
|
||||
|
@ -872,9 +878,10 @@ static int send_codec_cal(acdb_loader_get_calibration_t acdb_loader_get_calibrat
|
|||
codec_buffer.size = calib.data_size;
|
||||
codec_buffer.cal_type = type;
|
||||
if (ioctl(fd, SNDRV_CTL_IOCTL_HWDEP_CAL_TYPE, &codec_buffer) < 0)
|
||||
ALOGE("Failed to call ioctl for %s err=%d",
|
||||
cal_name_info[type], errno);
|
||||
ALOGD("%s cal sent for %s", __func__, cal_name_info[type]);
|
||||
ALOGE("Failed to call ioctl for %s err=%d calib.size=%d",
|
||||
cal_name_info[type], errno, codec_buffer.size);
|
||||
ALOGD("%s cal sent for %s calib.size=%d"
|
||||
, __func__, cal_name_info[type], codec_buffer.size);
|
||||
free(calib.buff);
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue