aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-06 09:40:09 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-07-12 18:34:28 -0400
commit25ea6db04a96d7871e7ece27d566f3228d59d932 (patch)
tree12d0b6735a451111c8b45ebb9523caac9578d0fc /net
parentc2ce920468624d87ec5f91f080ea99681dae6d88 (diff)
[Bluetooth] Remaining transitions to use kzalloc()
This patch makes the remaining transitions to use kzalloc(). Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/cmtp/capi.c4
-rw-r--r--net/bluetooth/cmtp/core.c3
-rw-r--r--net/bluetooth/hci_core.c7
-rw-r--r--net/bluetooth/hidp/core.c3
-rw-r--r--net/bluetooth/rfcomm/core.c9
-rw-r--r--net/bluetooth/rfcomm/tty.c3
-rw-r--r--net/bluetooth/sco.c12
7 files changed, 16 insertions, 25 deletions
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
index 6fb47e00e188..be04e9fb11f6 100644
--- a/net/bluetooth/cmtp/capi.c
+++ b/net/bluetooth/cmtp/capi.c
@@ -75,15 +75,13 @@
75 75
76static struct cmtp_application *cmtp_application_add(struct cmtp_session *session, __u16 appl) 76static struct cmtp_application *cmtp_application_add(struct cmtp_session *session, __u16 appl)
77{ 77{
78 struct cmtp_application *app = kmalloc(sizeof(*app), GFP_KERNEL); 78 struct cmtp_application *app = kzalloc(sizeof(*app), GFP_KERNEL);
79 79
80 BT_DBG("session %p application %p appl %d", session, app, appl); 80 BT_DBG("session %p application %p appl %d", session, app, appl);
81 81
82 if (!app) 82 if (!app)
83 return NULL; 83 return NULL;
84 84
85 memset(app, 0, sizeof(*app));
86
87 app->state = BT_OPEN; 85 app->state = BT_OPEN;
88 app->appl = appl; 86 app->appl = appl;
89 87
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 182254a580e2..b81a01c64aea 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -335,10 +335,9 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
335 baswap(&src, &bt_sk(sock->sk)->src); 335 baswap(&src, &bt_sk(sock->sk)->src);
336 baswap(&dst, &bt_sk(sock->sk)->dst); 336 baswap(&dst, &bt_sk(sock->sk)->dst);
337 337
338 session = kmalloc(sizeof(struct cmtp_session), GFP_KERNEL); 338 session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL);
339 if (!session) 339 if (!session)
340 return -ENOMEM; 340 return -ENOMEM;
341 memset(session, 0, sizeof(struct cmtp_session));
342 341
343 down_write(&cmtp_session_sem); 342 down_write(&cmtp_session_sem);
344 343
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 54e8e5ea2154..5ed474277903 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -336,9 +336,8 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data)
336 336
337 if (!(e = hci_inquiry_cache_lookup(hdev, &data->bdaddr))) { 337 if (!(e = hci_inquiry_cache_lookup(hdev, &data->bdaddr))) {
338 /* Entry not in the cache. Add new one. */ 338 /* Entry not in the cache. Add new one. */
339 if (!(e = kmalloc(sizeof(struct inquiry_entry), GFP_ATOMIC))) 339 if (!(e = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC)))
340 return; 340 return;
341 memset(e, 0, sizeof(struct inquiry_entry));
342 e->next = cache->list; 341 e->next = cache->list;
343 cache->list = e; 342 cache->list = e;
344 } 343 }
@@ -800,12 +799,10 @@ struct hci_dev *hci_alloc_dev(void)
800{ 799{
801 struct hci_dev *hdev; 800 struct hci_dev *hdev;
802 801
803 hdev = kmalloc(sizeof(struct hci_dev), GFP_KERNEL); 802 hdev = kzalloc(sizeof(struct hci_dev), GFP_KERNEL);
804 if (!hdev) 803 if (!hdev)
805 return NULL; 804 return NULL;
806 805
807 memset(hdev, 0, sizeof(struct hci_dev));
808
809 skb_queue_head_init(&hdev->driver_init); 806 skb_queue_head_init(&hdev->driver_init);
810 807
811 return hdev; 808 return hdev;
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index b9c24a55425c..c6e3a2c27c6e 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -582,10 +582,9 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
582 bacmp(&bt_sk(ctrl_sock->sk)->dst, &bt_sk(intr_sock->sk)->dst)) 582 bacmp(&bt_sk(ctrl_sock->sk)->dst, &bt_sk(intr_sock->sk)->dst))
583 return -ENOTUNIQ; 583 return -ENOTUNIQ;
584 584
585 session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL); 585 session = kzalloc(sizeof(struct hidp_session), GFP_KERNEL);
586 if (!session) 586 if (!session)
587 return -ENOMEM; 587 return -ENOMEM;
588 memset(session, 0, sizeof(struct hidp_session));
589 588
590 session->input = input_allocate_device(); 589 session->input = input_allocate_device();
591 if (!session->input) { 590 if (!session->input) {
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 155a2b93760e..77eab8f4c7fd 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -273,10 +273,10 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d)
273 273
274struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio) 274struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
275{ 275{
276 struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); 276 struct rfcomm_dlc *d = kzalloc(sizeof(*d), prio);
277
277 if (!d) 278 if (!d)
278 return NULL; 279 return NULL;
279 memset(d, 0, sizeof(*d));
280 280
281 init_timer(&d->timer); 281 init_timer(&d->timer);
282 d->timer.function = rfcomm_dlc_timeout; 282 d->timer.function = rfcomm_dlc_timeout;
@@ -289,6 +289,7 @@ struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
289 rfcomm_dlc_clear_state(d); 289 rfcomm_dlc_clear_state(d);
290 290
291 BT_DBG("%p", d); 291 BT_DBG("%p", d);
292
292 return d; 293 return d;
293} 294}
294 295
@@ -522,10 +523,10 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig)
522/* ---- RFCOMM sessions ---- */ 523/* ---- RFCOMM sessions ---- */
523static struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state) 524static struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state)
524{ 525{
525 struct rfcomm_session *s = kmalloc(sizeof(*s), GFP_KERNEL); 526 struct rfcomm_session *s = kzalloc(sizeof(*s), GFP_KERNEL);
527
526 if (!s) 528 if (!s)
527 return NULL; 529 return NULL;
528 memset(s, 0, sizeof(*s));
529 530
530 BT_DBG("session %p sock %p", s, sock); 531 BT_DBG("session %p sock %p", s, sock);
531 532
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 2ff2d5b87c93..bd8d671a0ba6 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -169,10 +169,9 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
169 169
170 BT_DBG("id %d channel %d", req->dev_id, req->channel); 170 BT_DBG("id %d channel %d", req->dev_id, req->channel);
171 171
172 dev = kmalloc(sizeof(struct rfcomm_dev), GFP_KERNEL); 172 dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL);
173 if (!dev) 173 if (!dev)
174 return -ENOMEM; 174 return -ENOMEM;
175 memset(dev, 0, sizeof(struct rfcomm_dev));
176 175
177 write_lock_bh(&rfcomm_dev_lock); 176 write_lock_bh(&rfcomm_dev_lock);
178 177
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 85defccc0287..7714a2ec3854 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -108,17 +108,14 @@ static void sco_sock_init_timer(struct sock *sk)
108static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status) 108static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
109{ 109{
110 struct hci_dev *hdev = hcon->hdev; 110 struct hci_dev *hdev = hcon->hdev;
111 struct sco_conn *conn; 111 struct sco_conn *conn = hcon->sco_data;
112
113 if ((conn = hcon->sco_data))
114 return conn;
115 112
116 if (status) 113 if (conn || status)
117 return conn; 114 return conn;
118 115
119 if (!(conn = kmalloc(sizeof(struct sco_conn), GFP_ATOMIC))) 116 conn = kzalloc(sizeof(struct sco_conn), GFP_ATOMIC);
117 if (!conn)
120 return NULL; 118 return NULL;
121 memset(conn, 0, sizeof(struct sco_conn));
122 119
123 spin_lock_init(&conn->lock); 120 spin_lock_init(&conn->lock);
124 121
@@ -134,6 +131,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
134 conn->mtu = 60; 131 conn->mtu = 60;
135 132
136 BT_DBG("hcon %p conn %p", hcon, conn); 133 BT_DBG("hcon %p conn %p", hcon, conn);
134
137 return conn; 135 return conn;
138} 136}
139 137