aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/caif/cfctrl.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index 047cd0eec022..44f270fc2d06 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -175,15 +175,17 @@ static void init_info(struct caif_payload_info *info, struct cfctrl *cfctrl)
175 175
176void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid) 176void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid)
177{ 177{
178 struct cfpkt *pkt;
178 struct cfctrl *cfctrl = container_obj(layer); 179 struct cfctrl *cfctrl = container_obj(layer);
179 struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
180 struct cflayer *dn = cfctrl->serv.layer.dn; 180 struct cflayer *dn = cfctrl->serv.layer.dn;
181 if (!pkt) 181
182 return;
183 if (!dn) { 182 if (!dn) {
184 pr_debug("not able to send enum request\n"); 183 pr_debug("not able to send enum request\n");
185 return; 184 return;
186 } 185 }
186 pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
187 if (!pkt)
188 return;
187 caif_assert(offsetof(struct cfctrl, serv.layer) == 0); 189 caif_assert(offsetof(struct cfctrl, serv.layer) == 0);
188 init_info(cfpkt_info(pkt), cfctrl); 190 init_info(cfpkt_info(pkt), cfctrl);
189 cfpkt_info(pkt)->dev_info->id = physlinkid; 191 cfpkt_info(pkt)->dev_info->id = physlinkid;
@@ -302,18 +304,17 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid,
302 struct cflayer *client) 304 struct cflayer *client)
303{ 305{
304 int ret; 306 int ret;
307 struct cfpkt *pkt;
305 struct cfctrl *cfctrl = container_obj(layer); 308 struct cfctrl *cfctrl = container_obj(layer);
306 struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
307 struct cflayer *dn = cfctrl->serv.layer.dn; 309 struct cflayer *dn = cfctrl->serv.layer.dn;
308 310
309 if (!pkt)
310 return -ENOMEM;
311
312 if (!dn) { 311 if (!dn) {
313 pr_debug("not able to send link-down request\n"); 312 pr_debug("not able to send link-down request\n");
314 return -ENODEV; 313 return -ENODEV;
315 } 314 }
316 315 pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
316 if (!pkt)
317 return -ENOMEM;
317 cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_DESTROY); 318 cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_DESTROY);
318 cfpkt_addbdy(pkt, channelid); 319 cfpkt_addbdy(pkt, channelid);
319 init_info(cfpkt_info(pkt), cfctrl); 320 init_info(cfpkt_info(pkt), cfctrl);