Commit d4bc0a26 authored by Michael Ellerman's avatar Michael Ellerman Committed by Damien Le Moal

ata: pata_macio: Use WARN instead of BUG

The overflow/underflow conditions in pata_macio_qc_prep() should never
happen. But if they do there's no need to kill the system entirely, a
WARN and failing the IO request should be sufficient and might allow the
system to keep running.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
parent 822c8020
...@@ -554,7 +554,8 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc) ...@@ -554,7 +554,8 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc)
while (sg_len) { while (sg_len) {
/* table overflow should never happen */ /* table overflow should never happen */
BUG_ON (pi++ >= MAX_DCMDS); if (WARN_ON_ONCE(pi >= MAX_DCMDS))
return AC_ERR_SYSTEM;
len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG; len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE); table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
...@@ -566,11 +567,13 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc) ...@@ -566,11 +567,13 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc)
addr += len; addr += len;
sg_len -= len; sg_len -= len;
++table; ++table;
++pi;
} }
} }
/* Should never happen according to Tejun */ /* Should never happen according to Tejun */
BUG_ON(!pi); if (WARN_ON_ONCE(!pi))
return AC_ERR_SYSTEM;
/* Convert the last command to an input/output */ /* Convert the last command to an input/output */
table--; table--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment