netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: olof@lixom.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2] niu: Cleanup PAGE_SIZE checks a bit
Date: Sun, 21 Oct 2007 16:35:58 -0700 (PDT)	[thread overview]
Message-ID: <20071021.163558.98394216.davem@davemloft.net> (raw)
In-Reply-To: <20071020193357.GA2090@lixom.net>

From: Olof Johansson <olof@lixom.net>
Date: Sat, 20 Oct 2007 14:33:57 -0500

> PAGE_SIZE in this case is 64KB, so I don't quite get why gcc can't tell
> that the line in question will never be reached.

GCC does not do that kind of full flow analysis based upon constant
expression simplification to determine if a store like this into a
type smaller than the constant value can handle can actually occur.

> I suggest the following instead, but I can unfortunately not do anything but
> build test it.
> 
> Also, the driver does some other checks to make sure that PAGE_SIZE is a
> power of two (BUILD_BUG_ON() in niu_init()), doesn't seem like that could
> ever be untrue? Or are there really archs with non-power-of-two PAGE_SIZE?

It was just overly-anal assertion checking.  I tend to prefer using
code instead of comments to describe invariants, but this one is
pretty unrealistic and silly.

> Signed-off-by: Olof Johansson <olof@lixom.net>
> 
> --
> 
> Ack! It should obviously use min(), not max()!

:-)

Applied, thanks!

      reply	other threads:[~2007-10-21 23:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20 19:06 [PATCH] niu: Cleanup PAGE_SIZE checks a bit Olof Johansson
2007-10-20 19:33 ` [PATCH v2] " Olof Johansson
2007-10-21 23:35   ` David Miller [this message]

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=20071021.163558.98394216.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=olof@lixom.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).