diff options
-rw-r--r-- | drivers/char/nozomi.c | 31 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb3/cxio_resource.c | 5 | ||||
-rw-r--r-- | drivers/media/video/meye.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 6 | ||||
-rw-r--r-- | drivers/scsi/libiscsi_tcp.c | 9 | ||||
-rw-r--r-- | drivers/scsi/libsrp.c | 7 | ||||
-rw-r--r-- | include/linux/kfifo.h | 4 |
7 files changed, 51 insertions, 16 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 | ||
1491 | err_free_tty: | ||
1492 | for (i = dc->index_start; i < dc->index_start + MAX_PORT; ++i) | ||
1493 | tty_unregister_device(ntty_driver, i); | ||
1494 | err_free_kfifo: | ||
1495 | for (i = 0; i < MAX_PORT; i++) | ||
1496 | kfifo_free(&dc->port[i].fifo_ul); | ||
1474 | err_free_sbuf: | 1497 | err_free_sbuf: |
1475 | kfree(dc->send_buf); | 1498 | kfree(dc->send_buf); |
1476 | iounmap(dc->base_addr); | 1499 | iounmap(dc->base_addr); |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c index dcbf2606c438..31f9201b2980 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_resource.c +++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c | |||
@@ -86,8 +86,9 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo, | |||
86 | kfifo_in(fifo, (unsigned char *) &i, sizeof(u32)); | 86 | kfifo_in(fifo, (unsigned char *) &i, sizeof(u32)); |
87 | 87 | ||
88 | for (i = 0; i < skip_low + skip_high; i++) | 88 | for (i = 0; i < skip_low + skip_high; i++) |
89 | kfifo_out_locked(fifo, (unsigned char *) &entry, | 89 | if (kfifo_out_locked(fifo, (unsigned char *) &entry, |
90 | sizeof(u32), fifo_lock); | 90 | sizeof(u32), fifo_lock) != sizeof(u32)) |
91 | break; | ||
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
93 | 94 | ||
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 884a569d60a2..b421858ccf90 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -968,8 +968,9 @@ static int meyeioc_sync(struct file *file, void *fh, int *i) | |||
968 | /* fall through */ | 968 | /* fall through */ |
969 | case MEYE_BUF_DONE: | 969 | case MEYE_BUF_DONE: |
970 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; | 970 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; |
971 | kfifo_out_locked(&meye.doneq, (unsigned char *)&unused, | 971 | if (kfifo_out_locked(&meye.doneq, (unsigned char *)&unused, |
972 | sizeof(int), &meye.doneq_lock); | 972 | sizeof(int), &meye.doneq_lock) != sizeof(int)) |
973 | break; | ||
973 | } | 974 | } |
974 | *i = meye.grab_buffer[*i].size; | 975 | *i = meye.grab_buffer[*i].size; |
975 | mutex_unlock(&meye.lock); | 976 | mutex_unlock(&meye.lock); |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2bcfa745524a..c2975c8e2f21 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -514,8 +514,10 @@ static int lbs_thread(void *data) | |||
514 | while (kfifo_len(&priv->event_fifo)) { | 514 | while (kfifo_len(&priv->event_fifo)) { |
515 | u32 event; | 515 | u32 event; |
516 | 516 | ||
517 | kfifo_out(&priv->event_fifo, (unsigned char *) &event, | 517 | if (kfifo_out(&priv->event_fifo, |
518 | sizeof(event)); | 518 | (unsigned char *) &event, sizeof(event)) != |
519 | sizeof(event)) | ||
520 | break; | ||
519 | spin_unlock_irq(&priv->driver_lock); | 521 | spin_unlock_irq(&priv->driver_lock); |
520 | lbs_process_event(priv, event); | 522 | lbs_process_event(priv, event); |
521 | spin_lock_irq(&priv->driver_lock); | 523 | spin_lock_irq(&priv->driver_lock); |
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index d51ffeca2ec9..db6856c138fc 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c | |||
@@ -990,8 +990,13 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task) | |||
990 | } | 990 | } |
991 | 991 | ||
992 | if (r2t == NULL) { | 992 | if (r2t == NULL) { |
993 | kfifo_out(&tcp_task->r2tqueue, | 993 | if (kfifo_out(&tcp_task->r2tqueue, |
994 | (void *)&tcp_task->r2t, sizeof(void *)); | 994 | (void *)&tcp_task->r2t, sizeof(void *)) != |
995 | sizeof(void *)) { | ||
996 | WARN_ONCE(1, "unexpected fifo state"); | ||
997 | r2t = NULL; | ||
998 | } | ||
999 | |||
995 | r2t = tcp_task->r2t; | 1000 | r2t = tcp_task->r2t; |
996 | } | 1001 | } |
997 | spin_unlock_bh(&session->lock); | 1002 | spin_unlock_bh(&session->lock); |
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 8424b8606efb..ab19b3b4be52 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -163,8 +163,11 @@ struct iu_entry *srp_iu_get(struct srp_target *target) | |||
163 | { | 163 | { |
164 | struct iu_entry *iue = NULL; | 164 | struct iu_entry *iue = NULL; |
165 | 165 | ||
166 | kfifo_out_locked(&target->iu_queue.queue, (void *) &iue, | 166 | if (kfifo_out_locked(&target->iu_queue.queue, (void *) &iue, |
167 | sizeof(void *), &target->iu_queue.lock); | 167 | sizeof(void *), &target->iu_queue.lock) != sizeof(void *)) { |
168 | WARN_ONCE(1, "unexpected fifo state"); | ||
169 | return NULL; | ||
170 | } | ||
168 | if (!iue) | 171 | if (!iue) |
169 | return iue; | 172 | return iue; |
170 | iue->target = target; | 173 | iue->target = target; |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 1b59c4a0e85f..5ed2565c89b6 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -56,7 +56,7 @@ extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | |||
56 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | 56 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, |
57 | gfp_t gfp_mask); | 57 | gfp_t gfp_mask); |
58 | extern void kfifo_free(struct kfifo *fifo); | 58 | extern void kfifo_free(struct kfifo *fifo); |
59 | extern __must_check unsigned int kfifo_in(struct kfifo *fifo, | 59 | extern unsigned int kfifo_in(struct kfifo *fifo, |
60 | const unsigned char *from, unsigned int len); | 60 | const unsigned char *from, unsigned int len); |
61 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, | 61 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
62 | unsigned char *to, unsigned int len); | 62 | unsigned char *to, unsigned int len); |
@@ -94,7 +94,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
94 | * the FIFO depending on the free space, and returns the number of | 94 | * the FIFO depending on the free space, and returns the number of |
95 | * bytes copied. | 95 | * bytes copied. |
96 | */ | 96 | */ |
97 | static inline __must_check unsigned int kfifo_in_locked(struct kfifo *fifo, | 97 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, |
98 | const unsigned char *from, unsigned int n, spinlock_t *lock) | 98 | const unsigned char *from, unsigned int n, spinlock_t *lock) |
99 | { | 99 | { |
100 | unsigned long flags; | 100 | unsigned long flags; |