All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] char: fix sparse variable shadowing and int as NULL pointer in rocket.c
Date: Wed, 27 Feb 2008 15:38:07 -0800	[thread overview]
Message-ID: <1204155487.20280.20.camel@brick> (raw)
In-Reply-To: <20080227152948.34b6e295.akpm@linux-foundation.org>

On Wed, 2008-02-27 at 15:29 -0800, Andrew Morton wrote:
> On Fri, 22 Feb 2008 09:46:59 -0800
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
> >
> > Subject: [PATCH] char: fix sparse variable shadowing and int as NULL pointer in rocket.c
> >
> 
> Please try to make the patch titles big-endian.  This one could have been
> 
> char: rocket.c: fix sparse variable shadowing and int as NULL pointer
> 

OK.

> or even
> 
> rocket.c: fix sparse variable shadowing and int as NULL pointer
> 
> > Nested min() macros shadow _x, separate into two lines.
> > drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
> > drivers/char/rocket.c:451:7: originally declared here
> > drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
> > drivers/char/rocket.c:451:7: originally declared here
> > drivers/char/rocket.c:451:7: warning: symbol '_y' shadows an earlier one
> > drivers/char/rocket.c:451:7: originally declared here
> > drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
> > drivers/char/rocket.c:1754:7: originally declared here
> > drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
> > drivers/char/rocket.c:1754:7: originally declared here
> > drivers/char/rocket.c:1754:7: warning: symbol '_y' shadows an earlier one
> > drivers/char/rocket.c:1754:7: originally declared here
> > drivers/char/rocket.c:1751:20: warning: Using plain integer as NULL pointer
> > 
> 
> That's really a sparse glitch.  There's nothing we can sanely do about it.
> 

Well, we can at least get rid of the warnings when min/max are nested.
I sent you a patch earlier today that uses different temp variables in
min/max/min_t/max_t to avoid this.  min/min and max/max nesting will
always see this.  I also introduced clamp()/clamp_t() in that patch
for use in libata and drivers/media.

> > ---
> >  drivers/char/rocket.c |    9 +++++----
> >  1 files changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
> > index 72f2892..2778d64 100644
> > --- a/drivers/char/rocket.c
> > +++ b/drivers/char/rocket.c
> > @@ -448,7 +448,8 @@ static void rp_do_transmit(struct r_port *info)
> >  	while (1) {
> >  		if (tty->stopped || tty->hw_stopped)
> >  			break;
> > -		c = min(info->xmit_fifo_room, min(info->xmit_cnt, XMIT_BUF_SIZE - info->xmit_tail));
> > +		c = min(info->xmit_fifo_room, info->xmit_cnt);
> > +		c = min(c, XMIT_BUF_SIZE - info->xmit_tail);
> 
> Apart from things like that.
> 
> Probably this code is cleaner than the old version so let's do it, but it
> seems that we need a general fix.

min3()?  No _good_ ideas I'm afraid.

Cheers,

Harvey


  reply	other threads:[~2008-02-27 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 17:46 [PATCH] char: fix sparse variable shadowing and int as NULL pointer in rocket.c Harvey Harrison
2008-02-27 23:29 ` Andrew Morton
2008-02-27 23:38   ` Harvey Harrison [this message]
2008-02-27 23:58     ` Andrew Morton

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=1204155487.20280.20.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@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.