diff options
Diffstat (limited to 'drivers/misc/mei/hbm.c')
-rw-r--r-- | drivers/misc/mei/hbm.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 239d7f5d6a92..c8412d41e4f1 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -105,21 +105,6 @@ void mei_hbm_idle(struct mei_device *dev) | |||
105 | } | 105 | } |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * mei_me_cl_remove_all - remove all me clients | ||
109 | * | ||
110 | * @dev: the device structure | ||
111 | */ | ||
112 | static void mei_me_cl_remove_all(struct mei_device *dev) | ||
113 | { | ||
114 | struct mei_me_client *me_cl, *next; | ||
115 | |||
116 | list_for_each_entry_safe(me_cl, next, &dev->me_clients, list) { | ||
117 | list_del(&me_cl->list); | ||
118 | kfree(me_cl); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * mei_hbm_reset - reset hbm counters and book keeping data structurs | 108 | * mei_hbm_reset - reset hbm counters and book keeping data structurs |
124 | * | 109 | * |
125 | * @dev: the device structure | 110 | * @dev: the device structure |
@@ -128,7 +113,7 @@ void mei_hbm_reset(struct mei_device *dev) | |||
128 | { | 113 | { |
129 | dev->me_client_index = 0; | 114 | dev->me_client_index = 0; |
130 | 115 | ||
131 | mei_me_cl_remove_all(dev); | 116 | mei_me_cl_rm_all(dev); |
132 | 117 | ||
133 | mei_hbm_idle(dev); | 118 | mei_hbm_idle(dev); |
134 | } | 119 | } |
@@ -339,11 +324,16 @@ static int mei_hbm_me_cl_add(struct mei_device *dev, | |||
339 | struct hbm_props_response *res) | 324 | struct hbm_props_response *res) |
340 | { | 325 | { |
341 | struct mei_me_client *me_cl; | 326 | struct mei_me_client *me_cl; |
327 | const uuid_le *uuid = &res->client_properties.protocol_name; | ||
328 | |||
329 | mei_me_cl_rm_by_uuid(dev, uuid); | ||
342 | 330 | ||
343 | me_cl = kzalloc(sizeof(struct mei_me_client), GFP_KERNEL); | 331 | me_cl = kzalloc(sizeof(struct mei_me_client), GFP_KERNEL); |
344 | if (!me_cl) | 332 | if (!me_cl) |
345 | return -ENOMEM; | 333 | return -ENOMEM; |
346 | 334 | ||
335 | mei_me_cl_init(me_cl); | ||
336 | |||
347 | me_cl->props = res->client_properties; | 337 | me_cl->props = res->client_properties; |
348 | me_cl->client_id = res->me_addr; | 338 | me_cl->client_id = res->me_addr; |
349 | me_cl->mei_flow_ctrl_creds = 0; | 339 | me_cl->mei_flow_ctrl_creds = 0; |
@@ -484,6 +474,7 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev, | |||
484 | struct hbm_flow_control *flow) | 474 | struct hbm_flow_control *flow) |
485 | { | 475 | { |
486 | struct mei_me_client *me_cl; | 476 | struct mei_me_client *me_cl; |
477 | int rets; | ||
487 | 478 | ||
488 | me_cl = mei_me_cl_by_id(dev, flow->me_addr); | 479 | me_cl = mei_me_cl_by_id(dev, flow->me_addr); |
489 | if (!me_cl) { | 480 | if (!me_cl) { |
@@ -492,14 +483,19 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev, | |||
492 | return -ENOENT; | 483 | return -ENOENT; |
493 | } | 484 | } |
494 | 485 | ||
495 | if (WARN_ON(me_cl->props.single_recv_buf == 0)) | 486 | if (WARN_ON(me_cl->props.single_recv_buf == 0)) { |
496 | return -EINVAL; | 487 | rets = -EINVAL; |
488 | goto out; | ||
489 | } | ||
497 | 490 | ||
498 | me_cl->mei_flow_ctrl_creds++; | 491 | me_cl->mei_flow_ctrl_creds++; |
499 | dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", | 492 | dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", |
500 | flow->me_addr, me_cl->mei_flow_ctrl_creds); | 493 | flow->me_addr, me_cl->mei_flow_ctrl_creds); |
501 | 494 | ||
502 | return 0; | 495 | rets = 0; |
496 | out: | ||
497 | mei_me_cl_put(me_cl); | ||
498 | return rets; | ||
503 | } | 499 | } |
504 | 500 | ||
505 | /** | 501 | /** |