ata: fix sparse warning in libata.h
authorHarvey Harrison <harvey.harrison@gmail.com>
Fri, 15 Feb 2008 21:41:32 +0000 (13:41 -0800)
committerJeff Garzik <jeff@garzik.org>
Wed, 20 Feb 2008 17:12:47 +0000 (12:12 -0500)
Avoids lots of these, also is more readable.
include/linux/libata.h:1210:13: warning: potentially expensive pointer subtraction

Change the subtraction to addition on the other side of the comparison.

Thanks to Christer Weinigel for the suggestion.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/libata.h

index 2e098f940cec74083142d07a017522261b526c5e..ce7603a73156b15490d054e4374fe1560d04a57f 100644 (file)
@@ -1197,7 +1197,7 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
                return ap->pmp_link;
        }
 
-       if (++link - ap->pmp_link < ap->nr_pmp_links)
+       if (++link < ap->nr_pmp_links + ap->pmp_link)
                return link;
        return NULL;
 }