sata_mv: safer logic for limit_warnings
authorMark Lord <liml@rtr.ca>
Thu, 19 Jun 2008 01:57:42 +0000 (21:57 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 4 Jul 2008 13:07:12 +0000 (09:07 -0400)
There is a miniscule chance that two separate host controllers
might be in sata_mv at the same time and manage to decrement
the static limit_warnings variable below zero.

Fix the comparison to deal with it.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/sata_mv.c

index 28092bc50146a04bf0298f48166550c8efa4320b..ad169ffbc4cb2a0ad8387c478b6a9540992f99b6 100644 (file)
@@ -1607,7 +1607,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                 * Much of the time, this could just work regardless.
                 * So for now, just log the incident, and allow the attempt.
                 */
-               if (limit_warnings && (qc->nbytes / qc->sect_size) > 1) {
+               if (limit_warnings > 0 && (qc->nbytes / qc->sect_size) > 1) {
                        --limit_warnings;
                        ata_link_printk(qc->dev->link, KERN_WARNING, DRV_NAME
                                        ": attempting PIO w/multiple DRQ: "