summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/atmodem/voicecall.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 178df20c..4d39b1e5 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
#include <glib.h>
@@ -99,7 +100,6 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
/* Generate a call structure for the waiting call */
call = g_try_new0(struct ofono_call, 1);
-
if (!call)
return NULL;
@@ -307,7 +307,6 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Generate a voice call that was just dialed, we guess the ID */
call = create_call(vc, 0, 0, 2, num, type, validity);
-
if (!call) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
@@ -633,7 +632,6 @@ static void cring_notify(GAtResult *result, gpointer user_data)
return;
line = g_at_result_iter_raw_line(&iter);
-
if (line == NULL)
return;
@@ -668,7 +666,6 @@ static void clip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(4),
at_util_call_compare_by_status);
-
if (l == NULL) {
ofono_error("CLIP for unknown call");
return;
@@ -763,7 +760,6 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
-
if (!call) {
ofono_error("Unable to malloc. Call management is fubar");
return;
@@ -842,7 +838,10 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
GAtChat *chat = data;
struct voicecall_data *vd;
- vd = g_new0(struct voicecall_data, 1);
+ vd = g_try_new0(struct voicecall_data, 1);
+ if (!vd)
+ return -ENOMEM;
+
vd->chat = g_at_chat_clone(chat);
vd->vendor = vendor;
@@ -853,6 +852,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
g_at_chat_send(vd->chat, "AT+COLP=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+CCWA=1", NULL,
at_voicecall_initialized, vc, NULL);
+
return 0;
}