All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Christer Weinigel <christer@weinigel.se>
Cc: Jeff Garzik <jeff@garzik.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ide <linux-ide@vger.kernel.org>
Subject: [PATCH] ata: fix sparse warning in libata.h
Date: Fri, 15 Feb 2008 13:41:32 -0800	[thread overview]
Message-ID: <1203111692.15275.50.camel@brick> (raw)
In-Reply-To: <20080215223250.0f229dbe@weinigel.se>

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>
---
 include/linux/libata.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index bc5a8d0..a6243bb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1207,7 +1207,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;
 }
-- 
1.5.4.1.1278.gc75be




  reply	other threads:[~2008-02-15 21:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14 19:16 [RFC-UGLYPATCH] ata: small optimization in linux/libata.h Harvey Harrison
2008-02-14 23:39 ` Tejun Heo
2008-02-15  0:05   ` Harvey Harrison
2008-02-15  1:58     ` Tejun Heo
2008-02-15  8:56       ` Mikael Pettersson
2008-02-15 16:10 ` Jeff Garzik
2008-02-15 21:32 ` Christer Weinigel
2008-02-15 21:41   ` Harvey Harrison [this message]
2008-02-15 22:18     ` [PATCH] ata: fix sparse warning in libata.h Tejun Heo
2008-02-20 17:12     ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1203111692.15275.50.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=christer@weinigel.se \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.