ASoC: dsp: amrwb_in: Fix AUDIO_GET_AMRWB_ENC_CONFIG ioctl

The non-blocking if-statement here causes the AUDIO_GET_AMRWB_ENC_CONFIG
ioctl to always return -EFAULT, even upon success. Fix it by correctly
guarding the -EFAULT return value.

Change-Id: Ia3a7247f5febb21d3b654c0ed29e81135e732c79
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[dereference23: Extend to audio-kernel 4.0]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
This commit is contained in:
Sultan Alsawaf 2021-07-10 16:57:36 -07:00 committed by Simon1511
parent 25afda004f
commit 20a093deea
2 changed files with 4 additions and 2 deletions

View File

@ -152,10 +152,11 @@ static long amrwb_in_ioctl(struct file *file,
}
case AUDIO_GET_AMRWB_ENC_CONFIG: {
if (copy_to_user((void *)arg, audio->enc_cfg,
sizeof(struct msm_audio_amrwb_enc_config)))
sizeof(struct msm_audio_amrwb_enc_config))) {
pr_err("%s: copy_to_user for AUDIO_GET_AMRWB_ENC_CONFIG failed\n",
__func__);
rc = -EFAULT;
}
break;
}
case AUDIO_SET_AMRWB_ENC_CONFIG: {

View File

@ -160,10 +160,11 @@ static long amrwb_in_ioctl(struct file *file,
}
case AUDIO_GET_AMRWB_ENC_CONFIG: {
if (copy_to_user((void *)arg, audio->enc_cfg,
sizeof(struct msm_audio_amrwb_enc_config)))
sizeof(struct msm_audio_amrwb_enc_config))) {
pr_err("%s: copy_to_user for AUDIO_GET_AMRWB_ENC_CONFIG failed\n",
__func__);
rc = -EFAULT;
}
break;
}
case AUDIO_SET_AMRWB_ENC_CONFIG: {