[PATCH] Warning fix for "comparison is always false"

Pavel Roskin proski at gnu.org
Tue Mar 16 19:00:11 GMT 2004

On Tue, 16 Mar 2004, Russell King wrote:

> On Tue, Mar 16, 2004 at 11:08:01PM +0000, Russell King wrote:
> > On Tue, Mar 16, 2004 at 06:00:42PM -0500, Pavel Roskin wrote:
> > > The attached patch fixes all warnings of this type:
> > >
> > > drivers/pcmcia/i82365.c: In function `i365_set_io_map':
> > > drivers/pcmcia/i82365.c:1134: warning: comparison is always false due to
> > > limited range of data type
> >
> > I'd rather they didn't get fixed just yet - my 11-pcmciaresource series
> > changes a fair amount in this area and this "fix" directly collides
> > with these patches.
> Oh, and these changes make these warnings go away as a matter of
> course.

It's not on http://pcmcia.arm.linux.org.uk/ yet, but I'll keep monitoring
that site.

There is one more kind if warnings to be fixed:

drivers/pcmcia/i82365.c: In function `is_alive':
drivers/pcmcia/i82365.c:672: warning: `check_region' is deprecated
(declared at include/linux/ioport.h:121)
drivers/pcmcia/i82365.c: In function `isa_probe':
drivers/pcmcia/i82365.c:806: warning: `check_region' is deprecated
(declared at include/linux/ioport.h:121)
drivers/pcmcia/tcic.c: In function `is_active':
drivers/pcmcia/tcic.c:347: warning: `check_region' is deprecated (declared
at include/linux/ioport.h:121)

I guess check_region is unneeded is isa_probe().  i82365 already uses
request_region() and handles its failure.

is_active()/is_alive() is more complicated.  This probably was designed to
work with such hacks as booting from PCMCIA flash or PCMCIA network cards.
In this case the socket driver finds that somebody has already activated
the card and leaves it alone.

We probably could replace check_region() with
request_region()/release_region() to avoid the warning.  On the other
hand, using PCMCIA devices without informing the socket driver is a pretty
gross hack, and we should think whether we still want to allow it.  After
all, 2.6 kernels support early userspace (Documentation/early-userspace).

Pavel Roskin

More information about the linux-pcmcia mailing list