aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/cmtp/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/cmtp/core.c')
-rw-r--r--net/bluetooth/cmtp/core.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 5a6e634f7fca..6c9c1fd601ca 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -53,15 +53,13 @@ static LIST_HEAD(cmtp_session_list);
53static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr) 53static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr)
54{ 54{
55 struct cmtp_session *session; 55 struct cmtp_session *session;
56 struct list_head *p;
57 56
58 BT_DBG(""); 57 BT_DBG("");
59 58
60 list_for_each(p, &cmtp_session_list) { 59 list_for_each_entry(session, &cmtp_session_list, list)
61 session = list_entry(p, struct cmtp_session, list);
62 if (!bacmp(bdaddr, &session->bdaddr)) 60 if (!bacmp(bdaddr, &session->bdaddr))
63 return session; 61 return session;
64 } 62
65 return NULL; 63 return NULL;
66} 64}
67 65
@@ -432,19 +430,16 @@ int cmtp_del_connection(struct cmtp_conndel_req *req)
432 430
433int cmtp_get_connlist(struct cmtp_connlist_req *req) 431int cmtp_get_connlist(struct cmtp_connlist_req *req)
434{ 432{
435 struct list_head *p; 433 struct cmtp_session *session;
436 int err = 0, n = 0; 434 int err = 0, n = 0;
437 435
438 BT_DBG(""); 436 BT_DBG("");
439 437
440 down_read(&cmtp_session_sem); 438 down_read(&cmtp_session_sem);
441 439
442 list_for_each(p, &cmtp_session_list) { 440 list_for_each_entry(session, &cmtp_session_list, list) {
443 struct cmtp_session *session;
444 struct cmtp_conninfo ci; 441 struct cmtp_conninfo ci;
445 442
446 session = list_entry(p, struct cmtp_session, list);
447
448 __cmtp_copy_session(session, &ci); 443 __cmtp_copy_session(session, &ci);
449 444
450 if (copy_to_user(req->ci, &ci, sizeof(ci))) { 445 if (copy_to_user(req->ci, &ci, sizeof(ci))) {