aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/nozomi.c
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2009-12-21 17:37:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-22 17:17:56 -0500
commit9842c38e917636fa7dc6b88aff17a8f1fd7f0cc0 (patch)
tree71d0b52ddc243743046bba9f774beca9febc393a /drivers/char/nozomi.c
parent7acd72eb85f1c7a15e8b5eb554994949241737f1 (diff)
kfifo: fix warn_unused_result
Fix the "ignoring return value of '...', declared with attribute warn_unused_result" compiler warning in several users of the new kfifo API. It removes the __must_check attribute from kfifo_in() and kfifo_in_locked() which must not necessary performed. Fix the allocation bug in the nozomi driver file, by moving out the kfifo_alloc from the interrupt handler into the probe function. Fix the kfifo_out() and kfifo_out_locked() users to handle a unexpected end of fifo. Signed-off-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/nozomi.c')
-rw-r--r--drivers/char/nozomi.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 9ef243429014..7d73cd430340 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -685,8 +685,6 @@ static int nozomi_read_config_table(struct nozomi *dc)
685 dump_table(dc); 685 dump_table(dc);
686 686
687 for (i = PORT_MDM; i < MAX_PORT; i++) { 687 for (i = PORT_MDM; i < MAX_PORT; i++) {
688 kfifo_alloc(&dc->port[i].fifo_ul,
689 FIFO_BUFFER_SIZE_UL, GFP_ATOMIC);
690 memset(&dc->port[i].ctrl_dl, 0, sizeof(struct ctrl_dl)); 688 memset(&dc->port[i].ctrl_dl, 0, sizeof(struct ctrl_dl));
691 memset(&dc->port[i].ctrl_ul, 0, sizeof(struct ctrl_ul)); 689 memset(&dc->port[i].ctrl_ul, 0, sizeof(struct ctrl_ul));
692 } 690 }
@@ -1433,6 +1431,16 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1433 goto err_free_sbuf; 1431 goto err_free_sbuf;
1434 } 1432 }
1435 1433
1434 for (i = PORT_MDM; i < MAX_PORT; i++) {
1435 if (kfifo_alloc(&dc->port[i].fifo_ul,
1436 FIFO_BUFFER_SIZE_UL, GFP_ATOMIC)) {
1437 dev_err(&pdev->dev,
1438 "Could not allocate kfifo buffer\n");
1439 ret = -ENOMEM;
1440 goto err_free_kfifo;
1441 }
1442 }
1443
1436 spin_lock_init(&dc->spin_mutex); 1444 spin_lock_init(&dc->spin_mutex);
1437 1445
1438 nozomi_setup_private_data(dc); 1446 nozomi_setup_private_data(dc);
@@ -1445,7 +1453,7 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1445 NOZOMI_NAME, dc); 1453 NOZOMI_NAME, dc);
1446 if (unlikely(ret)) { 1454 if (unlikely(ret)) {
1447 dev_err(&pdev->dev, "can't request irq %d\n", pdev->irq); 1455 dev_err(&pdev->dev, "can't request irq %d\n", pdev->irq);
1448 goto err_free_sbuf; 1456 goto err_free_kfifo;
1449 } 1457 }
1450 1458
1451 DBG1("base_addr: %p", dc->base_addr); 1459 DBG1("base_addr: %p", dc->base_addr);
@@ -1464,13 +1472,28 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1464 dc->state = NOZOMI_STATE_ENABLED; 1472 dc->state = NOZOMI_STATE_ENABLED;
1465 1473
1466 for (i = 0; i < MAX_PORT; i++) { 1474 for (i = 0; i < MAX_PORT; i++) {
1475 struct device *tty_dev;
1476
1467 mutex_init(&dc->port[i].tty_sem); 1477 mutex_init(&dc->port[i].tty_sem);
1468 tty_port_init(&dc->port[i].port); 1478 tty_port_init(&dc->port[i].port);
1469 tty_register_device(ntty_driver, dc->index_start + i, 1479 tty_dev = tty_register_device(ntty_driver, dc->index_start + i,
1470 &pdev->dev); 1480 &pdev->dev);
1481
1482 if (IS_ERR(tty_dev)) {
1483 ret = PTR_ERR(tty_dev);
1484 dev_err(&pdev->dev, "Could not allocate tty?\n");
1485 goto err_free_tty;
1486 }
1471 } 1487 }
1488
1472 return 0; 1489 return 0;
1473 1490
1491err_free_tty:
1492 for (i = dc->index_start; i < dc->index_start + MAX_PORT; ++i)
1493 tty_unregister_device(ntty_driver, i);
1494err_free_kfifo:
1495 for (i = 0; i < MAX_PORT; i++)
1496 kfifo_free(&dc->port[i].fifo_ul);
1474err_free_sbuf: 1497err_free_sbuf:
1475 kfree(dc->send_buf); 1498 kfree(dc->send_buf);
1476 iounmap(dc->base_addr); 1499 iounmap(dc->base_addr);