diff options
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 8afba0534779..539e861abc1e 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -29,20 +29,21 @@ | |||
29 | * mei_me_cl_by_uuid - locate index of me client | 29 | * mei_me_cl_by_uuid - locate index of me client |
30 | * | 30 | * |
31 | * @dev: mei device | 31 | * @dev: mei device |
32 | * | ||
33 | * Locking: called under "dev->device_lock" lock | ||
34 | * | ||
32 | * returns me client index or -ENOENT if not found | 35 | * returns me client index or -ENOENT if not found |
33 | */ | 36 | */ |
34 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *uuid) | 37 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *uuid) |
35 | { | 38 | { |
36 | int i, res = -ENOENT; | 39 | int i; |
37 | 40 | ||
38 | for (i = 0; i < dev->me_clients_num; ++i) | 41 | for (i = 0; i < dev->me_clients_num; ++i) |
39 | if (uuid_le_cmp(*uuid, | 42 | if (uuid_le_cmp(*uuid, |
40 | dev->me_clients[i].props.protocol_name) == 0) { | 43 | dev->me_clients[i].props.protocol_name) == 0) |
41 | res = i; | 44 | return i; |
42 | break; | ||
43 | } | ||
44 | 45 | ||
45 | return res; | 46 | return -ENOENT; |
46 | } | 47 | } |
47 | 48 | ||
48 | 49 | ||
@@ -60,16 +61,12 @@ int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *uuid) | |||
60 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id) | 61 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id) |
61 | { | 62 | { |
62 | int i; | 63 | int i; |
64 | |||
63 | for (i = 0; i < dev->me_clients_num; i++) | 65 | for (i = 0; i < dev->me_clients_num; i++) |
64 | if (dev->me_clients[i].client_id == client_id) | 66 | if (dev->me_clients[i].client_id == client_id) |
65 | break; | 67 | return i; |
66 | if (WARN_ON(dev->me_clients[i].client_id != client_id)) | ||
67 | return -ENOENT; | ||
68 | 68 | ||
69 | if (i == dev->me_clients_num) | 69 | return -ENOENT; |
70 | return -ENOENT; | ||
71 | |||
72 | return i; | ||
73 | } | 70 | } |
74 | 71 | ||
75 | 72 | ||