summaryrefslogtreecommitdiffstats
path: root/audio/audio_hw.c
diff options
context:
space:
mode:
authorKim Uk <w0806.kim@samsung.com>2011-07-19 12:57:26 -0700
committerSimon Wilson <simonwilson@google.com>2011-07-19 13:09:39 -0700
commitc2a69f502944444c9b17f3c00c413091dbcc5c75 (patch)
tree41db41dc7a14ce69269ef5a6b11d0b6699cfe036 /audio/audio_hw.c
parent2006f1c32bbc3a55bc8c598ce8484c9b5673b011 (diff)
downloaddevice_samsung_tuna-c2a69f502944444c9b17f3c00c413091dbcc5c75.zip
device_samsung_tuna-c2a69f502944444c9b17f3c00c413091dbcc5c75.tar.gz
device_samsung_tuna-c2a69f502944444c9b17f3c00c413091dbcc5c75.tar.bz2
audio: check for ril presence before calling into it
This prevents a seg fault if no ril is present. Change-Id: I5f9443e31bdcab07df21d9f12ed2dd92807300f8
Diffstat (limited to 'audio/audio_hw.c')
-rw-r--r--audio/audio_hw.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 3da3cee..02b8d33 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -267,8 +267,7 @@ struct tuna_audio_device {
int in_call;
/* RIL */
- void *ril_handle;
- void *ril_client;
+ struct ril_handle ril;
};
struct tuna_stream_out {
@@ -355,8 +354,8 @@ static int start_call(struct tuna_audio_device *adev)
}
}
- ril_set_call_clock_sync(adev->ril_client, SOUND_CLOCK_START);
- ril_set_call_audio_path(adev->ril_client, SOUND_AUDIO_PATH_HANDSET);
+ ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_START);
+ ril_set_call_audio_path(&adev->ril, SOUND_AUDIO_PATH_HANDSET);
pcm_start(adev->pcm_modem_dl);
pcm_start(adev->pcm_modem_ul);
@@ -888,7 +887,7 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
/* convert the float volume to something suitable for the RIL */
if (adev->in_call) {
int int_volume = (int)(volume * 5);
- ril_set_call_volume(adev->ril_client, SOUND_TYPE_VOICE, int_volume);
+ ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, int_volume);
}
return 0;
@@ -1032,7 +1031,7 @@ static int adev_close(hw_device_t *device)
struct tuna_audio_device *adev = (struct tuna_audio_device *)device;
/* RIL */
- ril_close(adev->ril_handle, adev->ril_client);
+ ril_close(&adev->ril);
mixer_close(adev->mixer);
free(device);
@@ -1127,7 +1126,7 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->pcm_modem_ul = NULL;
/* RIL */
- ril_open(&adev->ril_handle, &adev->ril_client);
+ ril_open(&adev->ril);
*device = &adev->device.common;