Skip to content

Commit 9d207ac

Browse files
axboehtejun
authored andcommitted
libata: remove assumption that ATA_MAX_QUEUE - 1 is the max
In a few spots we iterate to ATA_MAX_QUEUE -1, including internal knowledge that the last tag is the internal tag. Remove this assumption. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 2e2cc67 commit 9d207ac

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/ata/libata-eh.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,12 @@ static int ata_eh_nr_in_flight(struct ata_port *ap)
873873
int nr = 0;
874874

875875
/* count only non-internal commands */
876-
for (tag = 0; tag < ATA_MAX_QUEUE - 1; tag++)
876+
for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
877+
if (ata_tag_internal(tag))
878+
continue;
877879
if (ata_qc_from_tag(ap, tag))
878880
nr++;
881+
}
879882

880883
return nr;
881884
}
@@ -900,7 +903,7 @@ void ata_eh_fastdrain_timerfn(struct timer_list *t)
900903
/* No progress during the last interval, tag all
901904
* in-flight qcs as timed out and freeze the port.
902905
*/
903-
for (tag = 0; tag < ATA_MAX_QUEUE - 1; tag++) {
906+
for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
904907
struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag);
905908
if (qc)
906909
qc->err_mask |= AC_ERR_TIMEOUT;

0 commit comments

Comments
 (0)