aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cistpl.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-03 04:22:47 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:29:40 -0400
commit1168386aa7d850ead2ae135d5a7949a592c6e9a0 (patch)
tree9b36c2220df778fa74af93befb641c0569a5e862 /drivers/pcmcia/cistpl.c
parent5ff87db6792844ae24cc784512a95e0c94521b19 (diff)
pcmcia: deprecate CS_OUT_OF_RESOURCE
CS_OUT_OF_RESOURCE was almost only used to note -ENOMEM situations. Therefore, use -ENOMEM explicitely, and also print out warnings. CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r--drivers/pcmcia/cistpl.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 1a513d9a8612..8d37768d0b46 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -352,7 +352,9 @@ int verify_cis_cache(struct pcmcia_socket *s)
352 352
353 buf = kmalloc(256, GFP_KERNEL); 353 buf = kmalloc(256, GFP_KERNEL);
354 if (buf == NULL) 354 if (buf == NULL)
355 return -1; 355 dev_printk(KERN_WARNING, &s->dev,
356 "no memory for verifying CIS\n");
357 return -ENOMEM;
356 list_for_each_entry(cis, &s->cis_cache, node) { 358 list_for_each_entry(cis, &s->cis_cache, node) {
357 int len = cis->len; 359 int len = cis->len;
358 360
@@ -384,15 +386,19 @@ int verify_cis_cache(struct pcmcia_socket *s)
384int pcmcia_replace_cis(struct pcmcia_socket *s, 386int pcmcia_replace_cis(struct pcmcia_socket *s,
385 const u8 *data, const size_t len) 387 const u8 *data, const size_t len)
386{ 388{
387 if (len > CISTPL_MAX_CIS_SIZE) 389 if (len > CISTPL_MAX_CIS_SIZE) {
388 return CS_BAD_SIZE; 390 dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
389 kfree(s->fake_cis); 391 return -EINVAL;
390 s->fake_cis = kmalloc(len, GFP_KERNEL); 392 }
391 if (s->fake_cis == NULL) 393 kfree(s->fake_cis);
392 return CS_OUT_OF_RESOURCE; 394 s->fake_cis = kmalloc(len, GFP_KERNEL);
393 s->fake_cis_len = len; 395 if (s->fake_cis == NULL) {
394 memcpy(s->fake_cis, data, len); 396 dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
395 return 0; 397 return -ENOMEM;
398 }
399 s->fake_cis_len = len;
400 memcpy(s->fake_cis, data, len);
401 return 0;
396} 402}
397EXPORT_SYMBOL(pcmcia_replace_cis); 403EXPORT_SYMBOL(pcmcia_replace_cis);
398 404
@@ -1411,8 +1417,10 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t
1411 int ret; 1417 int ret;
1412 1418
1413 buf = kmalloc(256, GFP_KERNEL); 1419 buf = kmalloc(256, GFP_KERNEL);
1414 if (buf == NULL) 1420 if (buf == NULL) {
1415 return CS_OUT_OF_RESOURCE; 1421 dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
1422 return -ENOMEM;
1423 }
1416 tuple.DesiredTuple = code; 1424 tuple.DesiredTuple = code;
1417 tuple.Attributes = TUPLE_RETURN_COMMON; 1425 tuple.Attributes = TUPLE_RETURN_COMMON;
1418 ret = pccard_get_first_tuple(s, function, &tuple); 1426 ret = pccard_get_first_tuple(s, function, &tuple);
@@ -1452,12 +1460,15 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
1452 return CS_BAD_HANDLE; 1460 return CS_BAD_HANDLE;
1453 1461
1454 tuple = kmalloc(sizeof(*tuple), GFP_KERNEL); 1462 tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
1455 if (tuple == NULL) 1463 if (tuple == NULL) {
1456 return CS_OUT_OF_RESOURCE; 1464 dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n");
1465 return -ENOMEM;
1466 }
1457 p = kmalloc(sizeof(*p), GFP_KERNEL); 1467 p = kmalloc(sizeof(*p), GFP_KERNEL);
1458 if (p == NULL) { 1468 if (p == NULL) {
1459 kfree(tuple); 1469 kfree(tuple);
1460 return CS_OUT_OF_RESOURCE; 1470 dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n");
1471 return -ENOMEM;
1461 } 1472 }
1462 1473
1463 count = reserved = 0; 1474 count = reserved = 0;