10.06.2016 22:55, Tanu Kaskinen wrote:
If we can't fulfill the user request fully, I think we shouldn't
fulfill it at all, to make it clear that the requested operation
didn't succeed.
---
src/modules/alsa/module-alsa-card.c | 10 --
src/modules/bluetooth/module-bluez4-device.c | 7 +--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/modules/alsa/module-alsa-card.c
b/src/modules/alsa/module-alsa-card.c
index e5cc4ae..1ab2ea2 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -799,8 +799,14 @@ int pa__init(pa_module *m) {
goto fail;
}
-if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
-pa_card_new_data_set_profile(, profile);
+if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
+if (pa_hashmap_get(data.profiles, profile))
+pa_card_new_data_set_profile(, profile);
+else {
+pa_log("No such profile: %s", profile);
+goto fail;
Missed call to pa_card_new_data_done(); ?
+}
+}
u->card = pa_card_new(m->core, );
pa_card_new_data_done();
diff --git a/src/modules/bluetooth/module-bluez4-device.c
b/src/modules/bluetooth/module-bluez4-device.c
index 9a921a5..a2de525 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -2301,8 +2301,11 @@ static int add_card(struct userdata *u) {
if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
{
if (pa_hashmap_get(data.profiles, default_profile))
pa_card_new_data_set_profile(, default_profile);
-else
-pa_log_warn("Profile '%s' not valid or not supported by device.",
default_profile);
+else {
+pa_log("Profile '%s' not valid or not supported by device.",
default_profile);
+pa_card_new_data_done();
+return -1;
+}
}
u->card = pa_card_new(u->core, );
--
Alexander E. Patrakov
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss