Skip to content

Commit

Permalink
ata: fix sparse warning in libata.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harvey Harrison authored and Jeff Garzik committed Feb 20, 2008
1 parent 3326732 commit 5d44b41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5d44b41

Please sign in to comment.