From 8b54792cddd8e380b3a8a36636af7f8a665bef10 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Wed, 10 Feb 2010 15:53:05 -0800 Subject: Clean: no error path needed Remove unneeded error path and document the rationale behind it in __ofono_modem_get_list() and manager_get_properties(). --- src/manager.c | 7 ++++--- src/modem.c | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/manager.c b/src/manager.c index 593149c5..657f3faa 100644 --- a/src/manager.c +++ b/src/manager.c @@ -29,6 +29,10 @@ #include "ofono.h" +/* + * Note __ofono_modem_get_list() will abort if it cannot allocate + * memory; so no error path or cleanup is needed. + */ static DBusMessage *manager_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -43,9 +47,6 @@ static DBusMessage *manager_get_properties(DBusConnection *conn, modems = __ofono_modem_get_list(); - if (!modems) - return NULL; - dbus_message_iter_init_append(reply, &iter); dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, diff --git a/src/modem.c b/src/modem.c index bbc99051..200091af 100644 --- a/src/modem.c +++ b/src/modem.c @@ -881,7 +881,12 @@ void *ofono_devinfo_get_data(struct ofono_devinfo *info) return info->driver_data; } -/* Clients only need to free *modems */ +/* Clients only need to free *modems + * + * Note: this function will never return NULL. It will abort if it + * can't allocate memory for *modems; thus even an empty list will + * returns a non-NULL pointer. + */ const char **__ofono_modem_get_list() { GSList *l; -- cgit v1.2.3