linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Fix adding model app key binding
@ 2019-03-22  2:26 Inga Stotland
  2019-03-22 16:38 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2019-03-22  2:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, johan.hedberg, luiz.dentz, Inga Stotland

This fixes the situation when a new app key binding is being
added to a model and the list of bindings does not exist yet.
If the list does not exist, it is created and the binding is
added to it.

Also, remove unnecessary memory alloc check when model subscriptions
are added.
---
 mesh/model.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mesh/model.c b/mesh/model.c
index 80c30edba..a632d80e1 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -522,6 +522,9 @@ static void model_unbind_idx(struct mesh_node *node, struct mesh_model *mod,
 static void model_bind_idx(struct mesh_node *node, struct mesh_model *mod,
 								uint16_t idx)
 {
+	if (!mod->bindings)
+		mod->bindings = l_queue_new();
+
 	l_queue_push_tail(mod->bindings, L_UINT_TO_PTR(idx));
 
 	l_debug("Add %4.4x to model %8.8x", idx, mod->id);
@@ -689,8 +692,6 @@ static int add_sub(struct mesh_net *net, struct mesh_model *mod,
 
 	if (!mod->subs)
 		mod->subs = l_queue_new();
-	if (!mod->subs)
-		return MESH_STATUS_STORAGE_FAIL;
 
 	if (l_queue_find(mod->subs, simple_match, L_UINT_TO_PTR(grp)))
 		/* Group already exists */
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH BlueZ] mesh: Fix adding model app key binding
  2019-03-22  2:26 [PATCH BlueZ] mesh: Fix adding model app key binding Inga Stotland
@ 2019-03-22 16:38 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2019-03-22 16:38 UTC (permalink / raw)
  To: Stotland, Inga, linux-bluetooth; +Cc: johan.hedberg, luiz.dentz

patch applied

> -----Original Message-----
> From: Stotland, Inga
> Subject: [PATCH BlueZ] mesh: Fix adding model app key binding
> 
> This fixes the situation when a new app key binding is being added to a
> model and the list of bindings does not exist yet.
> If the list does not exist, it is created and the binding is added to it.
> 
> Also, remove unnecessary memory alloc check when model subscriptions are
> added.
> ---
>  mesh/model.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/model.c b/mesh/model.c index 80c30edba..a632d80e1
> 100644
> --- a/mesh/model.c
> +++ b/mesh/model.c
> @@ -522,6 +522,9 @@ static void model_unbind_idx(struct mesh_node
> *node, struct mesh_model *mod,  static void model_bind_idx(struct
> mesh_node *node, struct mesh_model *mod,
>  								uint16_t idx)
>  {
> +	if (!mod->bindings)
> +		mod->bindings = l_queue_new();
> +
>  	l_queue_push_tail(mod->bindings, L_UINT_TO_PTR(idx));
> 
>  	l_debug("Add %4.4x to model %8.8x", idx, mod->id); @@ -689,8
> +692,6 @@ static int add_sub(struct mesh_net *net, struct mesh_model
> *mod,
> 
>  	if (!mod->subs)
>  		mod->subs = l_queue_new();
> -	if (!mod->subs)
> -		return MESH_STATUS_STORAGE_FAIL;
> 
>  	if (l_queue_find(mod->subs, simple_match, L_UINT_TO_PTR(grp)))
>  		/* Group already exists */
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-22 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22  2:26 [PATCH BlueZ] mesh: Fix adding model app key binding Inga Stotland
2019-03-22 16:38 ` Gix, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).