From 6d24ad973b11a0cfd0c1253fb913c2b3c8700f3d Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Mon, 6 Jul 2020 11:04:01 +0900 Subject: [PATCH] Compare error value explicitly in sound_manager_private.c [Version] 0.6.21 [Issue Type] Improvement Change-Id: Ie763e1d81118bb0b75621b26accd50fb1b26bf99 Signed-off-by: Sangchul Lee --- packaging/capi-media-sound-manager.spec | 2 +- src/sound_manager_private.c | 156 ++++++++++++------------ 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 029509e..7f6bb34 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.6.20 +Version: 0.6.21 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index 280e9d0..f81beaa 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -815,7 +815,7 @@ void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, m goto LEAVE; } - if ((ret = _convert_stream_type_to_change_reason(reason, &change_reason))) { + if ((ret = _convert_stream_type_to_change_reason(reason, &change_reason)) != SOUND_MANAGER_ERROR_NONE) { LOGE("failed to _convert_stream_type_to_enum(), reason(%s), err(0x%08x)", reason, ret); goto LEAVE; } @@ -868,7 +868,7 @@ void _focus_watch_callback(int index, mm_sound_focus_type_e focus_type, mm_sound goto LEAVE; } - if ((ret = _convert_stream_type_to_change_reason(reason, &change_reason))) { + if ((ret = _convert_stream_type_to_change_reason(reason, &change_reason)) != SOUND_MANAGER_ERROR_NONE) { LOGE("failed to _convert_stream_type_to_enum(), reason(%s), err(0x%08x)", reason, ret); goto LEAVE; } @@ -957,7 +957,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) assert(stream_type); assert(info); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1093,7 +1093,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) assert(info); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; LOGI("stream info index(%u)", index); @@ -1169,7 +1169,7 @@ int _set_route_option(unsigned int index, const char *name, int value) assert(name); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; LOGI("[OPTION] %s(%d)", name, value); @@ -1220,7 +1220,7 @@ int _get_volume_max_level(const char *direction, const char *volume_type, unsign assert(volume_type); assert(max_level); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1269,7 +1269,7 @@ int _get_volume_level(const char *direction, const char *volume_type, unsigned i assert(volume_type); assert(level); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1316,7 +1316,7 @@ int _set_volume_level(const char *direction, const char *volume_type, unsigned i assert(direction); assert(volume_type); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1369,7 +1369,7 @@ int _get_current_volume_type(const char *direction, char **volume_type) assert(direction); assert(volume_type); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1423,7 +1423,7 @@ int _get_current_media_routing_path(const char *direction, sound_device_type_e * assert(direction); assert(device_type); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1516,7 +1516,7 @@ int _is_device_running_by_id(int device_id, bool *is_running) assert(is_running); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1565,7 +1565,7 @@ int _get_supported_sample_formats(int device_id, sound_sample_format_e **formats SM_ARG_CHECK(formats); SM_ARG_CHECK(num); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1633,10 +1633,10 @@ int _set_sample_format(int device_id, sound_sample_format_e format) GError *err = NULL; char *format_str = NULL; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = _convert_sample_format_enum_to_str(format, &format_str))) + if ((ret = _convert_sample_format_enum_to_str(format, &format_str)) != SOUND_MANAGER_ERROR_NONE) return ret; g_dbus_connection_call_sync(conn, @@ -1672,7 +1672,7 @@ int _get_sample_format(int device_id, sound_sample_format_e *format) SM_ARG_CHECK(format); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1722,7 +1722,7 @@ int _get_supported_sample_rates(int device_id, sound_sample_rate_e **rates, unsi SM_ARG_CHECK(rates); SM_ARG_CHECK(num); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1790,10 +1790,10 @@ int _set_sample_rate(int device_id, sound_sample_rate_e rate) GError *err = NULL; unsigned int _rate; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = _convert_sample_rate_enum_to_uint(rate, &_rate))) + if ((ret = _convert_sample_rate_enum_to_uint(rate, &_rate)) != SOUND_MANAGER_ERROR_NONE) return ret; g_dbus_connection_call_sync(conn, @@ -1829,7 +1829,7 @@ int _get_sample_rate(int device_id, sound_sample_rate_e *rate) SM_ARG_CHECK(rate); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1868,7 +1868,7 @@ int _set_avoid_resampling(int device_id, bool enable) GDBusConnection *conn = NULL; GError *err = NULL; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; g_dbus_connection_call_sync(conn, @@ -1903,7 +1903,7 @@ int _get_avoid_resampling(int device_id, bool *enabled) SM_ARG_CHECK(enabled); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -1942,7 +1942,7 @@ int _set_media_stream_only(int device_id, bool enable) GError *err = NULL; const char *stream_type; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; if (enable) @@ -1982,7 +1982,7 @@ int _get_media_stream_only(int device_id, bool *enabled) SM_ARG_CHECK(enabled); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -2081,20 +2081,20 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_ int i = 0; bool is_focus_cb_thread = false; - if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL))) + if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); if (is_focus_cb_thread) return SOUND_MANAGER_ERROR_INVALID_OPERATION; /* get configuration information of this stream type */ - if ((ret = _get_stream_conf_info(stream_h->stream_type, &stream_h->stream_conf_info))) + if ((ret = _get_stream_conf_info(stream_h->stream_type, &stream_h->stream_conf_info)) != SOUND_MANAGER_ERROR_NONE) return ret; LOGI("stream_conf_info : stream type[%s], priority[%d], route type[%d]", stream_h->stream_type, stream_h->stream_conf_info.priority, stream_h->stream_conf_info.route_type); - if ((ret = _make_pa_connection(&stream_h->pa_info, "SOUND_MANAGER_STREAM_INFO"))) + if ((ret = _make_pa_connection(&stream_h->pa_info, "SOUND_MANAGER_STREAM_INFO")) != SOUND_MANAGER_ERROR_NONE) goto ERROR; /* register focus */ @@ -2160,7 +2160,7 @@ int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h) int mm_ret = MM_ERROR_NONE; bool is_focus_cb_thread = false; - if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL))) + if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); if (is_focus_cb_thread) @@ -2336,13 +2336,13 @@ static int __is_available_device(sound_stream_info_s *stream_info, sound_device_ SM_ARG_CHECK(stream_info); SM_ARG_CHECK(device); - if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) + if ((ret = _convert_device_type(mm_sound_device_type, &device_type)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) + if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); if (device_direction & MM_SOUND_DEVICE_IO_DIRECTION_OUT) { @@ -2392,21 +2392,21 @@ int _add_device_for_stream_routing(sound_stream_info_s *stream_info, sound_devic SM_ARG_CHECK(stream_info); SM_ARG_CHECK(device); - if ((ret = __check_manual_route_type(stream_info))) + if ((ret = __check_manual_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + if ((mm_ret = mm_sound_get_device_id(device, &device_id)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) + if ((ret = _convert_device_type(mm_sound_device_type, &device_type)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) + if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str))) + if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; LOGI("*** added device[type:%s, id:%d]", device_type_str, device_id); @@ -2427,21 +2427,21 @@ int _remove_device_for_stream_routing(sound_stream_info_s *stream_info, sound_de SM_ARG_CHECK(stream_info); SM_ARG_CHECK(device); - if ((ret = __check_manual_route_type(stream_info))) + if ((ret = __check_manual_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + if ((mm_ret = mm_sound_get_device_id(device, &device_id)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) + if ((ret = _convert_device_type(mm_sound_device_type, &device_type)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) + if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str))) + if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; LOGI("*** removed device[type:%s, id:%d]", device_type_str, device_id); @@ -2456,7 +2456,7 @@ int _remove_all_devices_for_stream_routing(sound_stream_info_s *stream_info) SM_ARG_CHECK(stream_info); - if ((ret = __check_manual_route_type(stream_info))) + if ((ret = __check_manual_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2483,25 +2483,25 @@ int _add_device_id_for_stream_routing(sound_stream_info_s *stream_info, int devi SM_ARG_CHECK(stream_info); - if ((ret = __check_manual_route_type(stream_info))) + if ((ret = __check_manual_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) { + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type)) != MM_ERROR_NONE) { ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; } - if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) + if ((ret = _convert_device_type(mm_sound_device_type, &device_type)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; - if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) + if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; - if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) { + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction)) != MM_ERROR_NONE) { ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; } - if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str))) + if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; LOGI("*** added device by id[type:%s, id:%d]", device_type_str, device_id); @@ -2524,25 +2524,25 @@ int _remove_device_id_for_stream_routing(sound_stream_info_s *stream_info, int d SM_ARG_CHECK(stream_info); - if ((ret = __check_manual_route_type(stream_info))) + if ((ret = __check_manual_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) { + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type)) != MM_ERROR_NONE) { ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; } - if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) + if ((ret = _convert_device_type(mm_sound_device_type, &device_type)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; - if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) + if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; - if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) { + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction)) != MM_ERROR_NONE) { ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; } - if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str))) + if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str)) != SOUND_MANAGER_ERROR_NONE) goto LEAVE; LOGI("*** removed device by id[type:%s, id:%d]", device_type_str, device_id); @@ -2765,7 +2765,7 @@ int _set_volume_ratio(uint32_t stream_index, sound_stream_direction_e direction, GVariant *result = NULL; const gchar *dbus_ret = NULL; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -2816,7 +2816,7 @@ int _set_virtual_stream_volume(virtual_sound_stream_info_s *virtual_stream, doub for (i = 0; i < SOUND_STREAM_DIRECTION_MAX; i++) { if (virtual_stream->pa_stream[i]) { index = pa_stream_get_index(virtual_stream->pa_stream[i]); - if ((ret = _set_volume_ratio(index, i + 1, ratio))) { + if ((ret = _set_volume_ratio(index, i + 1, ratio)) != SOUND_MANAGER_ERROR_NONE) { if (ret == SOUND_MANAGER_ERROR_NO_DATA) { LOGE("something wrong, no match index of %u", index); ret = SOUND_MANAGER_ERROR_INTERNAL; @@ -2838,7 +2838,7 @@ int _set_acm_master_mode(bool on) GDBusConnection *conn = NULL; GError *err = NULL; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -2876,7 +2876,7 @@ int _activate_ducking(uint32_t stream_index, bool enable, const char *target_str GVariant *result = NULL; const gchar *dbus_ret = NULL; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -2931,7 +2931,7 @@ int _get_ducking_state(sound_pa_info_s *pa_info, bool *is_ducked) return SOUND_MANAGER_ERROR_INTERNAL; } - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -2986,7 +2986,7 @@ static int __invoke_ipc_set_preferred_device_id(sound_stream_info_s *stream_info SM_ARG_CHECK(stream_info); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; for (i = SOUND_DEVICE_IO_DIRECTION_IN; i < SOUND_DEVICE_IO_DIRECTION_BOTH; i++) { @@ -3057,19 +3057,19 @@ int _set_preferred_device(sound_stream_info_s *stream_info, sound_device_io_dire SM_ARG_CHECK(stream_info); /* allow only auto route type */ - if ((ret = __check_auto_route_type(stream_info))) + if ((ret = __check_auto_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; /* check if this device belongs to available devices of the stream info */ /* In case device is null, it's for unsetting preferred device, device_id will be 0. */ if (device) { - if ((ret = __is_available_device(stream_info, device, &available))) + if ((ret = __is_available_device(stream_info, device, &available)) != SOUND_MANAGER_ERROR_NONE) return ret; if (!available) return SOUND_MANAGER_ERROR_POLICY; - if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + if ((mm_ret = mm_sound_get_device_id(device, &device_id)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); - if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction)) != MM_ERROR_NONE) return _convert_sound_manager_error_code(__func__, mm_ret); if (!(io_direction & (direction + 1)) || ((int)io_direction < (int)(direction + 1))) { LOGE("device direction(0x%x), request direction(0x%x)", io_direction, (direction + 1)); @@ -3090,7 +3090,7 @@ int _set_preferred_device_id(sound_stream_info_s *stream_info, sound_device_io_d SM_ARG_CHECK(stream_info); /* allow only auto route type */ - if ((ret = __check_auto_route_type(stream_info))) + if ((ret = __check_auto_route_type(stream_info)) != SOUND_MANAGER_ERROR_NONE) return ret; /* check if this device belongs to available devices of the stream info */ @@ -3098,17 +3098,17 @@ int _set_preferred_device_id(sound_stream_info_s *stream_info, sound_device_io_d if (device_id) { MMSoundDevice_t device = NULL; - if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) { + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device)) != MM_ERROR_NONE) { LOGE("failed to mm_sound_get_device_by_id()"); return _convert_sound_manager_error_code(__func__, mm_ret); } - if ((ret = __is_available_device(stream_info, (sound_device_h)device, &available))) + if ((ret = __is_available_device(stream_info, (sound_device_h)device, &available)) != SOUND_MANAGER_ERROR_NONE) goto device_free; if (!available) { ret = SOUND_MANAGER_ERROR_POLICY; goto device_free; } - if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction))) { + if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction)) != MM_ERROR_NONE) { ret = _convert_sound_manager_error_code(__func__, mm_ret); goto device_free; } @@ -3137,7 +3137,7 @@ int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, i SM_ARG_CHECK(stream_info); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -3207,7 +3207,7 @@ static int __invoke_ipc_set_preemptive_device(sound_stream_type_e stream_type, s if ((ret = _convert_stream_type(stream_type, &stream_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; for (i = SOUND_DEVICE_IO_DIRECTION_IN; i < SOUND_DEVICE_IO_DIRECTION_BOTH; i++) { @@ -3272,7 +3272,7 @@ static int __invoke_ipc_get_preemptive_device(sound_stream_type_e stream_type, i if ((ret = _convert_stream_type(stream_type, &stream_type_str)) != SOUND_MANAGER_ERROR_NONE) return ret; - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; result = g_dbus_connection_call_sync(conn, @@ -3339,7 +3339,7 @@ int _get_latest_stream_pid(int stream_type, unsigned int *pid) SM_ARG_CHECK(pid); - if ((ret = __get_dbus_connection(&conn))) + if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; builder_for_stream_types = g_variant_builder_new(G_VARIANT_TYPE("as")); -- 2.34.1