diff options
Diffstat (limited to 'net/caif/cfctrl.c')
-rw-r--r-- | net/caif/cfctrl.c | 23 |
1 files changed, 6 insertions, 17 deletions
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"); |