diff options
author | Joe Perches <joe@perches.com> | 2011-08-25 09:22:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-28 17:16:13 -0400 |
commit | 7ac2ed0ceeafa130f85aa947b271b571c68b9e75 (patch) | |
tree | 7f08a891990d46c84b0dd6b665fc0a70451fb6b2 /net/caif/cfctrl.c | |
parent | 343e43c02850a3abcd22bd144e5bdbc92fdd273c (diff) |
caif: Remove OOM messages, use kzalloc
Remove per site OOM messages because they duplicate
the generic mm subsystem OOM message.
Use kzalloc instead of kmalloc/memset
when next to the OOM message removals.
Reduces object size (allyesconfig ~2%)
$ size -t drivers/net/caif/built-in.o.old net/caif/built-in.o.old
text data bss dec hex filename
32297 700 8224 41221 a105 drivers/net/caif/built-in.o.old
72159 1317 20552 94028 16f4c net/caif/built-in.o.old
104456 2017 28776 135249 21051 (TOTALS)
$ size -t drivers/net/caif/built-in.o.new net/caif/built-in.o.new
text data bss dec hex filename
31975 700 8184 40859 9f9b drivers/net/caif/built-in.o.new
70748 1317 20152 92217 16839 net/caif/built-in.o.new
102723 2017 28336 133076 207d4 (TOTALS)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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"); |