aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-01-26 00:38:34 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 16:02:47 -0500
commite5f49c3b837ff90c8aec2c6c66c4966080aced06 (patch)
tree16f6cb30602b9e63b9dc3a0a4ef8b56dcaf10346 /drivers/firewire
parent93c4cceb963ebb133531e5e3f4f6e2da0d222656 (diff)
firewire: Sanitize send error codes.
Drop the negative errnos and use RCODEs for all error codes in the complete transaction callback. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-ohci.c20
-rw-r--r--drivers/firewire/fw-transaction.c12
-rw-r--r--drivers/firewire/fw-transaction.h2
3 files changed, 18 insertions, 16 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index ac6c018de0dc..58bc85dd7917 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -376,7 +376,7 @@ at_context_setup_packet(struct at_context *ctx, struct list_head *list)
376 packet->payload_length, 376 packet->payload_length,
377 DMA_TO_DEVICE); 377 DMA_TO_DEVICE);
378 if (packet->payload_bus == 0) { 378 if (packet->payload_bus == 0) {
379 complete_transmission(packet, -ENOMEM, list); 379 complete_transmission(packet, RCODE_SEND_ERROR, list);
380 return; 380 return;
381 } 381 }
382 382
@@ -438,7 +438,7 @@ at_context_setup_packet(struct at_context *ctx, struct list_head *list)
438 /* We dont return error codes from this function; all 438 /* We dont return error codes from this function; all
439 * transmission errors are reported through the 439 * transmission errors are reported through the
440 * callback. */ 440 * callback. */
441 complete_transmission(packet, -ESTALE, list); 441 complete_transmission(packet, RCODE_GENERATION, list);
442 } 442 }
443} 443}
444 444
@@ -484,26 +484,26 @@ static void at_context_tasklet(unsigned long data)
484 switch (evt) { 484 switch (evt) {
485 case OHCI1394_evt_timeout: 485 case OHCI1394_evt_timeout:
486 /* Async response transmit timed out. */ 486 /* Async response transmit timed out. */
487 complete_transmission(packet, -ETIMEDOUT, &list); 487 complete_transmission(packet, RCODE_CANCELLED, &list);
488 break; 488 break;
489 489
490 case OHCI1394_evt_flushed: 490 case OHCI1394_evt_flushed:
491 /* The packet was flushed should give same 491 /* The packet was flushed should give same
492 * error as when we try to use a stale 492 * error as when we try to use a stale
493 * generation count. */ 493 * generation count. */
494 complete_transmission(packet, -ESTALE, &list); 494 complete_transmission(packet,
495 RCODE_GENERATION, &list);
495 break; 496 break;
496 497
497 case OHCI1394_evt_missing_ack: 498 case OHCI1394_evt_missing_ack:
498 /* This would be a higher level software 499 /* Using a valid (current) generation count,
499 * error, it is using a valid (current) 500 * but the node is not on the bus or not
500 * generation count, but the node is not on 501 * sending acks. */
501 * the bus. */ 502 complete_transmission(packet, RCODE_NO_ACK, &list);
502 complete_transmission(packet, -ENODEV, &list);
503 break; 503 break;
504 504
505 default: 505 default:
506 complete_transmission(packet, -EIO, &list); 506 complete_transmission(packet, RCODE_SEND_ERROR, &list);
507 break; 507 break;
508 } 508 }
509 } else 509 } else
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 780ed2b44983..8387c8ea6735 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -93,15 +93,15 @@ transmit_complete_callback(struct fw_packet *packet,
93 close_transaction(t, card, RCODE_BUSY, NULL, 0); 93 close_transaction(t, card, RCODE_BUSY, NULL, 0);
94 break; 94 break;
95 case ACK_DATA_ERROR: 95 case ACK_DATA_ERROR:
96 close_transaction(t, card, RCODE_DATA_ERROR, NULL, 0);
97 break;
96 case ACK_TYPE_ERROR: 98 case ACK_TYPE_ERROR:
97 close_transaction(t, card, RCODE_SEND_ERROR, NULL, 0); 99 close_transaction(t, card, RCODE_TYPE_ERROR, NULL, 0);
98 break; 100 break;
99 default: 101 default:
100 /* FIXME: In this case, status is a negative errno, 102 /* In this case the ack is really a juju specific
101 * corresponding to an OHCI specific transmit error 103 * rcode, so just forward that to the callback. */
102 * code. We should map that to an RCODE instead of 104 close_transaction(t, card, status, NULL, 0);
103 * just the generic RCODE_SEND_ERROR. */
104 close_transaction(t, card, RCODE_SEND_ERROR, NULL, 0);
105 break; 105 break;
106 } 106 }
107} 107}
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index fb46ef78a323..ad7ba32755eb 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -87,6 +87,8 @@
87#define RCODE_SEND_ERROR 0x10 87#define RCODE_SEND_ERROR 0x10
88#define RCODE_CANCELLED 0x11 88#define RCODE_CANCELLED 0x11
89#define RCODE_BUSY 0x12 89#define RCODE_BUSY 0x12
90#define RCODE_GENERATION 0x13
91#define RCODE_NO_ACK 0x14
90 92
91#define RETRY_1 0x00 93#define RETRY_1 0x00
92#define RETRY_X 0x01 94#define RETRY_X 0x01