impl: Only return -ENOENT when param does not exist

We checked above if the param exited and returned -ENOENT if not.
When we can't find any parameter, simply return 0.
This commit is contained in:
Wim Taymans 2020-12-17 15:56:22 +01:00
parent 91b0d3bb39
commit f8c96167f9
3 changed files with 3 additions and 12 deletions

View file

@ -323,7 +323,6 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
struct spa_result_device_params result; struct spa_result_device_params result;
uint32_t count = 0; uint32_t count = 0;
bool found = false;
result.id = param_id; result.id = param_id;
result.next = 0; result.next = 0;
@ -333,8 +332,6 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
if (p->id != param_id) if (p->id != param_id)
continue; continue;
found = true;
if (result.index < index) if (result.index < index)
continue; continue;
@ -348,7 +345,7 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
if (++count == max) if (++count == max)
break; break;
} }
res = found ? 0 : -ENOENT; res = 0;
} else { } else {
user_data.cache = impl->cache_params && filter == NULL; user_data.cache = impl->cache_params && filter == NULL;

View file

@ -1808,7 +1808,6 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
struct spa_result_node_params result; struct spa_result_node_params result;
uint32_t count = 0; uint32_t count = 0;
bool found = false;
result.id = param_id; result.id = param_id;
result.next = 0; result.next = 0;
@ -1818,8 +1817,6 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
if (p->id != param_id) if (p->id != param_id)
continue; continue;
found = true;
if (result.index < index) if (result.index < index)
continue; continue;
@ -1833,7 +1830,7 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
if (++count == max) if (++count == max)
break; break;
} }
res = found ? 0 : -ENOENT; res = 0;
} else { } else {
user_data.cache = impl->cache_params && filter == NULL; user_data.cache = impl->cache_params && filter == NULL;

View file

@ -1128,7 +1128,6 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
struct spa_result_node_params result; struct spa_result_node_params result;
uint32_t count = 0; uint32_t count = 0;
bool found = false;
result.id = param_id; result.id = param_id;
result.next = 0; result.next = 0;
@ -1138,8 +1137,6 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
if (p->id != param_id) if (p->id != param_id)
continue; continue;
found = true;
if (result.index < index) if (result.index < index)
continue; continue;
@ -1153,7 +1150,7 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
if (++count == max) if (++count == max)
break; break;
} }
res = found ? 0 : -ENOENT; res = 0;
} else { } else {
user_data.cache = filter == NULL; user_data.cache = filter == NULL;