diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-02 23:56:40 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-02 23:56:40 -0400 |
commit | 31cbecb4ab538f433145bc5a46f3bea9b9627031 (patch) | |
tree | d6206d42dea7298f7ef05fd1f7bf474245f0d43a /net/caif | |
parent | 2b72c9ccd22c4a3299e5a358dcd639fb253730f4 (diff) | |
parent | 278c023a99b0d6b471d0f4a79835c703482e29ac (diff) |
Merge branch 'osd-devel' into nfs-for-next
Diffstat (limited to 'net/caif')
-rw-r--r-- | net/caif/caif_dev.c | 5 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 38 | ||||
-rw-r--r-- | net/caif/cfctrl.c | 23 | ||||
-rw-r--r-- | net/caif/cfdbgl.c | 7 | ||||
-rw-r--r-- | net/caif/cfdgml.c | 7 | ||||
-rw-r--r-- | net/caif/cffrml.c | 7 | ||||
-rw-r--r-- | net/caif/cfmuxl.c | 6 | ||||
-rw-r--r-- | net/caif/cfrfml.c | 7 | ||||
-rw-r--r-- | net/caif/cfserl.c | 7 | ||||
-rw-r--r-- | net/caif/cfsrvl.c | 8 | ||||
-rw-r--r-- | net/caif/cfutill.c | 7 | ||||
-rw-r--r-- | net/caif/cfveil.c | 7 | ||||
-rw-r--r-- | net/caif/cfvidl.c | 7 |
13 files changed, 47 insertions, 89 deletions
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 7f9ac0742d19..47fc8f3a47cf 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -212,8 +212,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, | |||
212 | enum cfcnfg_phy_preference pref; | 212 | enum cfcnfg_phy_preference pref; |
213 | enum cfcnfg_phy_type phy_type; | 213 | enum cfcnfg_phy_type phy_type; |
214 | struct cfcnfg *cfg; | 214 | struct cfcnfg *cfg; |
215 | struct caif_device_entry_list *caifdevs = | 215 | struct caif_device_entry_list *caifdevs; |
216 | caif_device_list(dev_net(dev)); | ||
217 | 216 | ||
218 | if (dev->type != ARPHRD_CAIF) | 217 | if (dev->type != ARPHRD_CAIF) |
219 | return 0; | 218 | return 0; |
@@ -222,6 +221,8 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, | |||
222 | if (cfg == NULL) | 221 | if (cfg == NULL) |
223 | return 0; | 222 | return 0; |
224 | 223 | ||
224 | caifdevs = caif_device_list(dev_net(dev)); | ||
225 | |||
225 | switch (what) { | 226 | switch (what) { |
226 | case NETDEV_REGISTER: | 227 | case NETDEV_REGISTER: |
227 | caifd = caif_device_alloc(dev); | 228 | caifd = caif_device_alloc(dev); |
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 52fe33bee029..00523ecc4ced 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -78,10 +78,8 @@ struct cfcnfg *cfcnfg_create(void) | |||
78 | 78 | ||
79 | /* Initiate this layer */ | 79 | /* Initiate this layer */ |
80 | this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC); | 80 | this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC); |
81 | if (!this) { | 81 | if (!this) |
82 | pr_warn("Out of memory\n"); | ||
83 | return NULL; | 82 | return NULL; |
84 | } | ||
85 | this->mux = cfmuxl_create(); | 83 | this->mux = cfmuxl_create(); |
86 | if (!this->mux) | 84 | if (!this->mux) |
87 | goto out_of_mem; | 85 | goto out_of_mem; |
@@ -108,8 +106,6 @@ struct cfcnfg *cfcnfg_create(void) | |||
108 | 106 | ||
109 | return this; | 107 | return this; |
110 | out_of_mem: | 108 | out_of_mem: |
111 | pr_warn("Out of memory\n"); | ||
112 | |||
113 | synchronize_rcu(); | 109 | synchronize_rcu(); |
114 | 110 | ||
115 | kfree(this->mux); | 111 | kfree(this->mux); |
@@ -448,10 +444,8 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, | |||
448 | "- unknown channel type\n"); | 444 | "- unknown channel type\n"); |
449 | goto unlock; | 445 | goto unlock; |
450 | } | 446 | } |
451 | if (!servicel) { | 447 | if (!servicel) |
452 | pr_warn("Out of memory\n"); | ||
453 | goto unlock; | 448 | goto unlock; |
454 | } | ||
455 | layer_set_dn(servicel, cnfg->mux); | 449 | layer_set_dn(servicel, cnfg->mux); |
456 | cfmuxl_set_uplayer(cnfg->mux, servicel, channel_id); | 450 | cfmuxl_set_uplayer(cnfg->mux, servicel, channel_id); |
457 | layer_set_up(servicel, adapt_layer); | 451 | layer_set_up(servicel, adapt_layer); |
@@ -473,7 +467,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
473 | { | 467 | { |
474 | struct cflayer *frml; | 468 | struct cflayer *frml; |
475 | struct cflayer *phy_driver = NULL; | 469 | struct cflayer *phy_driver = NULL; |
476 | struct cfcnfg_phyinfo *phyinfo; | 470 | struct cfcnfg_phyinfo *phyinfo = NULL; |
477 | int i; | 471 | int i; |
478 | u8 phyid; | 472 | u8 phyid; |
479 | 473 | ||
@@ -488,25 +482,25 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
488 | goto got_phyid; | 482 | goto got_phyid; |
489 | } | 483 | } |
490 | pr_warn("Too many CAIF Link Layers (max 6)\n"); | 484 | pr_warn("Too many CAIF Link Layers (max 6)\n"); |
491 | goto out; | 485 | goto out_err; |
492 | 486 | ||
493 | got_phyid: | 487 | got_phyid: |
494 | phyinfo = kzalloc(sizeof(struct cfcnfg_phyinfo), GFP_ATOMIC); | 488 | phyinfo = kzalloc(sizeof(struct cfcnfg_phyinfo), GFP_ATOMIC); |
489 | if (!phyinfo) | ||
490 | goto out_err; | ||
495 | 491 | ||
496 | switch (phy_type) { | 492 | switch (phy_type) { |
497 | case CFPHYTYPE_FRAG: | 493 | case CFPHYTYPE_FRAG: |
498 | phy_driver = | 494 | phy_driver = |
499 | cfserl_create(CFPHYTYPE_FRAG, phyid, stx); | 495 | cfserl_create(CFPHYTYPE_FRAG, phyid, stx); |
500 | if (!phy_driver) { | 496 | if (!phy_driver) |
501 | pr_warn("Out of memory\n"); | 497 | goto out_err; |
502 | goto out; | ||
503 | } | ||
504 | break; | 498 | break; |
505 | case CFPHYTYPE_CAIF: | 499 | case CFPHYTYPE_CAIF: |
506 | phy_driver = NULL; | 500 | phy_driver = NULL; |
507 | break; | 501 | break; |
508 | default: | 502 | default: |
509 | goto out; | 503 | goto out_err; |
510 | } | 504 | } |
511 | phy_layer->id = phyid; | 505 | phy_layer->id = phyid; |
512 | phyinfo->pref = pref; | 506 | phyinfo->pref = pref; |
@@ -520,11 +514,8 @@ got_phyid: | |||
520 | 514 | ||
521 | frml = cffrml_create(phyid, fcs); | 515 | frml = cffrml_create(phyid, fcs); |
522 | 516 | ||
523 | if (!frml) { | 517 | if (!frml) |
524 | pr_warn("Out of memory\n"); | 518 | goto out_err; |
525 | kfree(phyinfo); | ||
526 | goto out; | ||
527 | } | ||
528 | phyinfo->frm_layer = frml; | 519 | phyinfo->frm_layer = frml; |
529 | layer_set_up(frml, cnfg->mux); | 520 | layer_set_up(frml, cnfg->mux); |
530 | 521 | ||
@@ -540,7 +531,12 @@ got_phyid: | |||
540 | } | 531 | } |
541 | 532 | ||
542 | list_add_rcu(&phyinfo->node, &cnfg->phys); | 533 | list_add_rcu(&phyinfo->node, &cnfg->phys); |
543 | out: | 534 | mutex_unlock(&cnfg->lock); |
535 | return; | ||
536 | |||
537 | out_err: | ||
538 | kfree(phy_driver); | ||
539 | kfree(phyinfo); | ||
544 | mutex_unlock(&cnfg->lock); | 540 | mutex_unlock(&cnfg->lock); |
545 | } | 541 | } |
546 | EXPORT_SYMBOL(cfcnfg_add_phy_layer); | 542 | EXPORT_SYMBOL(cfcnfg_add_phy_layer); |
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c index e22671bed669..5cf52225692e 100644 --- a/net/caif/cfctrl.c +++ b/net/caif/cfctrl.c | |||
@@ -35,15 +35,12 @@ struct cflayer *cfctrl_create(void) | |||
35 | { | 35 | { |
36 | struct dev_info dev_info; | 36 | struct dev_info dev_info; |
37 | struct cfctrl *this = | 37 | struct cfctrl *this = |
38 | kmalloc(sizeof(struct cfctrl), GFP_ATOMIC); | 38 | kzalloc(sizeof(struct cfctrl), GFP_ATOMIC); |
39 | if (!this) { | 39 | if (!this) |
40 | pr_warn("Out of memory\n"); | ||
41 | return NULL; | 40 | return NULL; |
42 | } | ||
43 | caif_assert(offsetof(struct cfctrl, serv.layer) == 0); | 41 | caif_assert(offsetof(struct cfctrl, serv.layer) == 0); |
44 | memset(&dev_info, 0, sizeof(dev_info)); | 42 | memset(&dev_info, 0, sizeof(dev_info)); |
45 | dev_info.id = 0xff; | 43 | dev_info.id = 0xff; |
46 | memset(this, 0, sizeof(*this)); | ||
47 | cfsrvl_init(&this->serv, 0, &dev_info, false); | 44 | cfsrvl_init(&this->serv, 0, &dev_info, false); |
48 | atomic_set(&this->req_seq_no, 1); | 45 | atomic_set(&this->req_seq_no, 1); |
49 | atomic_set(&this->rsp_seq_no, 1); | 46 | atomic_set(&this->rsp_seq_no, 1); |
@@ -180,10 +177,8 @@ void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid) | |||
180 | struct cfctrl *cfctrl = container_obj(layer); | 177 | struct cfctrl *cfctrl = container_obj(layer); |
181 | struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); | 178 | struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); |
182 | struct cflayer *dn = cfctrl->serv.layer.dn; | 179 | struct cflayer *dn = cfctrl->serv.layer.dn; |
183 | if (!pkt) { | 180 | if (!pkt) |
184 | pr_warn("Out of memory\n"); | ||
185 | return; | 181 | return; |
186 | } | ||
187 | if (!dn) { | 182 | if (!dn) { |
188 | pr_debug("not able to send enum request\n"); | 183 | pr_debug("not able to send enum request\n"); |
189 | return; | 184 | return; |
@@ -224,10 +219,8 @@ int cfctrl_linkup_request(struct cflayer *layer, | |||
224 | } | 219 | } |
225 | 220 | ||
226 | pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); | 221 | pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); |
227 | if (!pkt) { | 222 | if (!pkt) |
228 | pr_warn("Out of memory\n"); | ||
229 | return -ENOMEM; | 223 | return -ENOMEM; |
230 | } | ||
231 | cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_SETUP); | 224 | cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_SETUP); |
232 | cfpkt_addbdy(pkt, (param->chtype << 4) | param->linktype); | 225 | cfpkt_addbdy(pkt, (param->chtype << 4) | param->linktype); |
233 | cfpkt_addbdy(pkt, (param->priority << 3) | param->phyid); | 226 | cfpkt_addbdy(pkt, (param->priority << 3) | param->phyid); |
@@ -275,10 +268,8 @@ int cfctrl_linkup_request(struct cflayer *layer, | |||
275 | return -EINVAL; | 268 | return -EINVAL; |
276 | } | 269 | } |
277 | req = kzalloc(sizeof(*req), GFP_KERNEL); | 270 | req = kzalloc(sizeof(*req), GFP_KERNEL); |
278 | if (!req) { | 271 | if (!req) |
279 | pr_warn("Out of memory\n"); | ||
280 | return -ENOMEM; | 272 | return -ENOMEM; |
281 | } | ||
282 | req->client_layer = user_layer; | 273 | req->client_layer = user_layer; |
283 | req->cmd = CFCTRL_CMD_LINK_SETUP; | 274 | req->cmd = CFCTRL_CMD_LINK_SETUP; |
284 | req->param = *param; | 275 | req->param = *param; |
@@ -312,10 +303,8 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid, | |||
312 | struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); | 303 | struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); |
313 | struct cflayer *dn = cfctrl->serv.layer.dn; | 304 | struct cflayer *dn = cfctrl->serv.layer.dn; |
314 | 305 | ||
315 | if (!pkt) { | 306 | if (!pkt) |
316 | pr_warn("Out of memory\n"); | ||
317 | return -ENOMEM; | 307 | return -ENOMEM; |
318 | } | ||
319 | 308 | ||
320 | if (!dn) { | 309 | if (!dn) { |
321 | pr_debug("not able to send link-down request\n"); | 310 | pr_debug("not able to send link-down request\n"); |
diff --git a/net/caif/cfdbgl.c b/net/caif/cfdbgl.c index 11a2af4c162a..65d6ef3cf9aa 100644 --- a/net/caif/cfdbgl.c +++ b/net/caif/cfdbgl.c | |||
@@ -19,13 +19,10 @@ static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt); | |||
19 | 19 | ||
20 | struct cflayer *cfdbgl_create(u8 channel_id, struct dev_info *dev_info) | 20 | struct cflayer *cfdbgl_create(u8 channel_id, struct dev_info *dev_info) |
21 | { | 21 | { |
22 | struct cfsrvl *dbg = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); | 22 | struct cfsrvl *dbg = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); |
23 | if (!dbg) { | 23 | if (!dbg) |
24 | pr_warn("Out of memory\n"); | ||
25 | return NULL; | 24 | return NULL; |
26 | } | ||
27 | caif_assert(offsetof(struct cfsrvl, layer) == 0); | 25 | caif_assert(offsetof(struct cfsrvl, layer) == 0); |
28 | memset(dbg, 0, sizeof(struct cfsrvl)); | ||
29 | cfsrvl_init(dbg, channel_id, dev_info, false); | 26 | cfsrvl_init(dbg, channel_id, dev_info, false); |
30 | dbg->layer.receive = cfdbgl_receive; | 27 | dbg->layer.receive = cfdbgl_receive; |
31 | dbg->layer.transmit = cfdbgl_transmit; | 28 | dbg->layer.transmit = cfdbgl_transmit; |
diff --git a/net/caif/cfdgml.c b/net/caif/cfdgml.c index 0382dec84fdc..0f5ff27aa41c 100644 --- a/net/caif/cfdgml.c +++ b/net/caif/cfdgml.c | |||
@@ -26,13 +26,10 @@ static int cfdgml_transmit(struct cflayer *layr, struct cfpkt *pkt); | |||
26 | 26 | ||
27 | struct cflayer *cfdgml_create(u8 channel_id, struct dev_info *dev_info) | 27 | struct cflayer *cfdgml_create(u8 channel_id, struct dev_info *dev_info) |
28 | { | 28 | { |
29 | struct cfsrvl *dgm = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); | 29 | struct cfsrvl *dgm = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); |
30 | if (!dgm) { | 30 | if (!dgm) |
31 | pr_warn("Out of memory\n"); | ||
32 | return NULL; | 31 | return NULL; |
33 | } | ||
34 | caif_assert(offsetof(struct cfsrvl, layer) == 0); | 32 | caif_assert(offsetof(struct cfsrvl, layer) == 0); |
35 | memset(dgm, 0, sizeof(struct cfsrvl)); | ||
36 | cfsrvl_init(dgm, channel_id, dev_info, true); | 33 | cfsrvl_init(dgm, channel_id, dev_info, true); |
37 | dgm->layer.receive = cfdgml_receive; | 34 | dgm->layer.receive = cfdgml_receive; |
38 | dgm->layer.transmit = cfdgml_transmit; | 35 | dgm->layer.transmit = cfdgml_transmit; |
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index 04204b202718..f39921171d0d 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
@@ -34,11 +34,9 @@ static u32 cffrml_rcv_error; | |||
34 | static u32 cffrml_rcv_checsum_error; | 34 | static u32 cffrml_rcv_checsum_error; |
35 | struct cflayer *cffrml_create(u16 phyid, bool use_fcs) | 35 | struct cflayer *cffrml_create(u16 phyid, bool use_fcs) |
36 | { | 36 | { |
37 | struct cffrml *this = kmalloc(sizeof(struct cffrml), GFP_ATOMIC); | 37 | struct cffrml *this = kzalloc(sizeof(struct cffrml), GFP_ATOMIC); |
38 | if (!this) { | 38 | if (!this) |
39 | pr_warn("Out of memory\n"); | ||
40 | return NULL; | 39 | return NULL; |
41 | } | ||
42 | this->pcpu_refcnt = alloc_percpu(int); | 40 | this->pcpu_refcnt = alloc_percpu(int); |
43 | if (this->pcpu_refcnt == NULL) { | 41 | if (this->pcpu_refcnt == NULL) { |
44 | kfree(this); | 42 | kfree(this); |
@@ -47,7 +45,6 @@ struct cflayer *cffrml_create(u16 phyid, bool use_fcs) | |||
47 | 45 | ||
48 | caif_assert(offsetof(struct cffrml, layer) == 0); | 46 | caif_assert(offsetof(struct cffrml, layer) == 0); |
49 | 47 | ||
50 | memset(this, 0, sizeof(struct cflayer)); | ||
51 | this->layer.receive = cffrml_receive; | 48 | this->layer.receive = cffrml_receive; |
52 | this->layer.transmit = cffrml_transmit; | 49 | this->layer.transmit = cffrml_transmit; |
53 | this->layer.ctrlcmd = cffrml_ctrlcmd; | 50 | this->layer.ctrlcmd = cffrml_ctrlcmd; |
diff --git a/net/caif/cfmuxl.c b/net/caif/cfmuxl.c index c23979e79dfa..b36f24a4c8e7 100644 --- a/net/caif/cfmuxl.c +++ b/net/caif/cfmuxl.c | |||
@@ -108,7 +108,7 @@ struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid) | |||
108 | int idx = phyid % DN_CACHE_SIZE; | 108 | int idx = phyid % DN_CACHE_SIZE; |
109 | 109 | ||
110 | spin_lock_bh(&muxl->transmit_lock); | 110 | spin_lock_bh(&muxl->transmit_lock); |
111 | rcu_assign_pointer(muxl->dn_cache[idx], NULL); | 111 | RCU_INIT_POINTER(muxl->dn_cache[idx], NULL); |
112 | dn = get_from_id(&muxl->frml_list, phyid); | 112 | dn = get_from_id(&muxl->frml_list, phyid); |
113 | if (dn == NULL) | 113 | if (dn == NULL) |
114 | goto out; | 114 | goto out; |
@@ -164,7 +164,7 @@ struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 id) | |||
164 | if (up == NULL) | 164 | if (up == NULL) |
165 | goto out; | 165 | goto out; |
166 | 166 | ||
167 | rcu_assign_pointer(muxl->up_cache[idx], NULL); | 167 | RCU_INIT_POINTER(muxl->up_cache[idx], NULL); |
168 | list_del_rcu(&up->node); | 168 | list_del_rcu(&up->node); |
169 | out: | 169 | out: |
170 | spin_unlock_bh(&muxl->receive_lock); | 170 | spin_unlock_bh(&muxl->receive_lock); |
@@ -261,7 +261,7 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
261 | 261 | ||
262 | idx = layer->id % UP_CACHE_SIZE; | 262 | idx = layer->id % UP_CACHE_SIZE; |
263 | spin_lock_bh(&muxl->receive_lock); | 263 | spin_lock_bh(&muxl->receive_lock); |
264 | rcu_assign_pointer(muxl->up_cache[idx], NULL); | 264 | RCU_INIT_POINTER(muxl->up_cache[idx], NULL); |
265 | list_del_rcu(&layer->node); | 265 | list_del_rcu(&layer->node); |
266 | spin_unlock_bh(&muxl->receive_lock); | 266 | spin_unlock_bh(&muxl->receive_lock); |
267 | } | 267 | } |
diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c index 0deabb440051..81660f809713 100644 --- a/net/caif/cfrfml.c +++ b/net/caif/cfrfml.c | |||
@@ -46,13 +46,10 @@ struct cflayer *cfrfml_create(u8 channel_id, struct dev_info *dev_info, | |||
46 | int mtu_size) | 46 | int mtu_size) |
47 | { | 47 | { |
48 | int tmp; | 48 | int tmp; |
49 | struct cfrfml *this = | 49 | struct cfrfml *this = kzalloc(sizeof(struct cfrfml), GFP_ATOMIC); |
50 | kzalloc(sizeof(struct cfrfml), GFP_ATOMIC); | ||
51 | 50 | ||
52 | if (!this) { | 51 | if (!this) |
53 | pr_warn("Out of memory\n"); | ||
54 | return NULL; | 52 | return NULL; |
55 | } | ||
56 | 53 | ||
57 | cfsrvl_init(&this->serv, channel_id, dev_info, false); | 54 | cfsrvl_init(&this->serv, channel_id, dev_info, false); |
58 | this->serv.release = cfrfml_release; | 55 | this->serv.release = cfrfml_release; |
diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c index 2715c84cfa87..797c8d165993 100644 --- a/net/caif/cfserl.c +++ b/net/caif/cfserl.c | |||
@@ -33,13 +33,10 @@ static void cfserl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
33 | 33 | ||
34 | struct cflayer *cfserl_create(int type, int instance, bool use_stx) | 34 | struct cflayer *cfserl_create(int type, int instance, bool use_stx) |
35 | { | 35 | { |
36 | struct cfserl *this = kmalloc(sizeof(struct cfserl), GFP_ATOMIC); | 36 | struct cfserl *this = kzalloc(sizeof(struct cfserl), GFP_ATOMIC); |
37 | if (!this) { | 37 | if (!this) |
38 | pr_warn("Out of memory\n"); | ||
39 | return NULL; | 38 | return NULL; |
40 | } | ||
41 | caif_assert(offsetof(struct cfserl, layer) == 0); | 39 | caif_assert(offsetof(struct cfserl, layer) == 0); |
42 | memset(this, 0, sizeof(struct cfserl)); | ||
43 | this->layer.receive = cfserl_receive; | 40 | this->layer.receive = cfserl_receive; |
44 | this->layer.transmit = cfserl_transmit; | 41 | this->layer.transmit = cfserl_transmit; |
45 | this->layer.ctrlcmd = cfserl_ctrlcmd; | 42 | this->layer.ctrlcmd = cfserl_ctrlcmd; |
diff --git a/net/caif/cfsrvl.c b/net/caif/cfsrvl.c index 535a1e72b366..b99f5b22689d 100644 --- a/net/caif/cfsrvl.c +++ b/net/caif/cfsrvl.c | |||
@@ -108,10 +108,8 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) | |||
108 | struct caif_payload_info *info; | 108 | struct caif_payload_info *info; |
109 | u8 flow_on = SRVL_FLOW_ON; | 109 | u8 flow_on = SRVL_FLOW_ON; |
110 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); | 110 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); |
111 | if (!pkt) { | 111 | if (!pkt) |
112 | pr_warn("Out of memory\n"); | ||
113 | return -ENOMEM; | 112 | return -ENOMEM; |
114 | } | ||
115 | 113 | ||
116 | if (cfpkt_add_head(pkt, &flow_on, 1) < 0) { | 114 | if (cfpkt_add_head(pkt, &flow_on, 1) < 0) { |
117 | pr_err("Packet is erroneous!\n"); | 115 | pr_err("Packet is erroneous!\n"); |
@@ -130,10 +128,8 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) | |||
130 | struct caif_payload_info *info; | 128 | struct caif_payload_info *info; |
131 | u8 flow_off = SRVL_FLOW_OFF; | 129 | u8 flow_off = SRVL_FLOW_OFF; |
132 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); | 130 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); |
133 | if (!pkt) { | 131 | if (!pkt) |
134 | pr_warn("Out of memory\n"); | ||
135 | return -ENOMEM; | 132 | return -ENOMEM; |
136 | } | ||
137 | 133 | ||
138 | if (cfpkt_add_head(pkt, &flow_off, 1) < 0) { | 134 | if (cfpkt_add_head(pkt, &flow_off, 1) < 0) { |
139 | pr_err("Packet is erroneous!\n"); | 135 | pr_err("Packet is erroneous!\n"); |
diff --git a/net/caif/cfutill.c b/net/caif/cfutill.c index 98e027db18ed..53e49f3e3af3 100644 --- a/net/caif/cfutill.c +++ b/net/caif/cfutill.c | |||
@@ -26,13 +26,10 @@ static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt); | |||
26 | 26 | ||
27 | struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info) | 27 | struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info) |
28 | { | 28 | { |
29 | struct cfsrvl *util = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); | 29 | struct cfsrvl *util = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); |
30 | if (!util) { | 30 | if (!util) |
31 | pr_warn("Out of memory\n"); | ||
32 | return NULL; | 31 | return NULL; |
33 | } | ||
34 | caif_assert(offsetof(struct cfsrvl, layer) == 0); | 32 | caif_assert(offsetof(struct cfsrvl, layer) == 0); |
35 | memset(util, 0, sizeof(struct cfsrvl)); | ||
36 | cfsrvl_init(util, channel_id, dev_info, true); | 33 | cfsrvl_init(util, channel_id, dev_info, true); |
37 | util->layer.receive = cfutill_receive; | 34 | util->layer.receive = cfutill_receive; |
38 | util->layer.transmit = cfutill_transmit; | 35 | util->layer.transmit = cfutill_transmit; |
diff --git a/net/caif/cfveil.c b/net/caif/cfveil.c index 3ec83fbc2887..910ab0661f66 100644 --- a/net/caif/cfveil.c +++ b/net/caif/cfveil.c | |||
@@ -25,13 +25,10 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt); | |||
25 | 25 | ||
26 | struct cflayer *cfvei_create(u8 channel_id, struct dev_info *dev_info) | 26 | struct cflayer *cfvei_create(u8 channel_id, struct dev_info *dev_info) |
27 | { | 27 | { |
28 | struct cfsrvl *vei = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); | 28 | struct cfsrvl *vei = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); |
29 | if (!vei) { | 29 | if (!vei) |
30 | pr_warn("Out of memory\n"); | ||
31 | return NULL; | 30 | return NULL; |
32 | } | ||
33 | caif_assert(offsetof(struct cfsrvl, layer) == 0); | 31 | caif_assert(offsetof(struct cfsrvl, layer) == 0); |
34 | memset(vei, 0, sizeof(struct cfsrvl)); | ||
35 | cfsrvl_init(vei, channel_id, dev_info, true); | 32 | cfsrvl_init(vei, channel_id, dev_info, true); |
36 | vei->layer.receive = cfvei_receive; | 33 | vei->layer.receive = cfvei_receive; |
37 | vei->layer.transmit = cfvei_transmit; | 34 | vei->layer.transmit = cfvei_transmit; |
diff --git a/net/caif/cfvidl.c b/net/caif/cfvidl.c index b2f5989ad455..e3f37db40ac3 100644 --- a/net/caif/cfvidl.c +++ b/net/caif/cfvidl.c | |||
@@ -21,14 +21,11 @@ static int cfvidl_transmit(struct cflayer *layr, struct cfpkt *pkt); | |||
21 | 21 | ||
22 | struct cflayer *cfvidl_create(u8 channel_id, struct dev_info *dev_info) | 22 | struct cflayer *cfvidl_create(u8 channel_id, struct dev_info *dev_info) |
23 | { | 23 | { |
24 | struct cfsrvl *vid = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); | 24 | struct cfsrvl *vid = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); |
25 | if (!vid) { | 25 | if (!vid) |
26 | pr_warn("Out of memory\n"); | ||
27 | return NULL; | 26 | return NULL; |
28 | } | ||
29 | caif_assert(offsetof(struct cfsrvl, layer) == 0); | 27 | caif_assert(offsetof(struct cfsrvl, layer) == 0); |
30 | 28 | ||
31 | memset(vid, 0, sizeof(struct cfsrvl)); | ||
32 | cfsrvl_init(vid, channel_id, dev_info, false); | 29 | cfsrvl_init(vid, channel_id, dev_info, false); |
33 | vid->layer.receive = cfvidl_receive; | 30 | vid->layer.receive = cfvidl_receive; |
34 | vid->layer.transmit = cfvidl_transmit; | 31 | vid->layer.transmit = cfvidl_transmit; |