From 066690b17f16ccc98e027b481cd26baeaaade68f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 13 Oct 2011 13:47:56 -0500 Subject: [PATCH] handsfree: Pass the error information to the core if available. This is the preferred way, so that the core can take into account the error information in the future if required. --- drivers/hfpmodem/handsfree.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c index 16a395b..c9bae65 100644 --- a/drivers/hfpmodem/handsfree.c +++ b/drivers/hfpmodem/handsfree.c @@ -95,14 +95,18 @@ static void hfp_request_phone_number_cb(gboolean ok, GAtResult *result, { struct cb_data *cbd = user_data; ofono_handsfree_phone_cb_t cb = cbd->cb; - void *data = cbd->data; GAtResultIter iter; + struct ofono_error error; const char *num; int type; struct ofono_phone_number phone_number; - if (!ok) - goto fail; + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) { + cb(&error, NULL, cbd->data); + return; + } g_at_result_iter_init(&iter, result); @@ -122,11 +126,11 @@ static void hfp_request_phone_number_cb(gboolean ok, GAtResult *result, phone_number.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0'; phone_number.type = type; - CALLBACK_WITH_SUCCESS(cb, &phone_number, data); + cb(&error, &phone_number, cbd->data); return; fail: - CALLBACK_WITH_FAILURE(cb, NULL, data); + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); } static void hfp_request_phone_number(struct ofono_handsfree *hf, -- 2.7.4