public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6] clean-up: fixes "unsigned<0" warning
@ 2004-12-06 20:44 Riina Kikas
  0 siblings, 0 replies; 6+ messages in thread
From: Riina Kikas @ 2004-12-06 20:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: mroos

This patch fixes 5 warnings "comparison of unsigned expression < 0 is
always false" occuring on lines 1987, 1988, 1989, 1990, 1992

Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>

--- a/drivers/block/as-iosched.c	2004-11-30 19:43:52.000000000 +0000
+++ b/drivers/block/as-iosched.c	2004-10-31 13:09:19.000000000 +0000
@@ -1974,23 +1974,21 @@
  SHOW_FUNCTION(as_write_batchexpire_show, ad->batch_expire[REQ_ASYNC]);
  #undef SHOW_FUNCTION

-#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX)				\
+#define STORE_FUNCTION(__FUNC, __PTR, MAX)				\
  static ssize_t __FUNC(struct as_data *ad, const char *page, size_t count)	\
  {									\
  	int ret = as_var_store(__PTR, (page), count);		\
-	if (*(__PTR) < (MIN))						\
-		*(__PTR) = (MIN);					\
-	else if (*(__PTR) > (MAX))					\
+	if (*(__PTR) > (MAX))						\
  		*(__PTR) = (MAX);					\
  	return ret;							\
  }
-STORE_FUNCTION(as_readexpire_store, &ad->fifo_expire[REQ_SYNC], 0, INT_MAX);
-STORE_FUNCTION(as_writeexpire_store, &ad->fifo_expire[REQ_ASYNC], 0, INT_MAX);
-STORE_FUNCTION(as_anticexpire_store, &ad->antic_expire, 0, INT_MAX);
+STORE_FUNCTION(as_readexpire_store, &ad->fifo_expire[REQ_SYNC], INT_MAX);
+STORE_FUNCTION(as_writeexpire_store, &ad->fifo_expire[REQ_ASYNC], INT_MAX);
+STORE_FUNCTION(as_anticexpire_store, &ad->antic_expire, INT_MAX);
  STORE_FUNCTION(as_read_batchexpire_store,
-			&ad->batch_expire[REQ_SYNC], 0, INT_MAX);
+			&ad->batch_expire[REQ_SYNC], INT_MAX);
  STORE_FUNCTION(as_write_batchexpire_store,
-			&ad->batch_expire[REQ_ASYNC], 0, INT_MAX);
+			&ad->batch_expire[REQ_ASYNC], INT_MAX);
  #undef STORE_FUNCTION

  static struct as_fs_entry as_est_entry = {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2.6] clean-up: fixes "unsigned<0" warning
@ 2004-12-06 20:47 Riina Kikas
  0 siblings, 0 replies; 6+ messages in thread
From: Riina Kikas @ 2004-12-06 20:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: mroos

This patch fixes warning "comparison of unsigned expression < 0 is always false"
occuring on line 110

Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>

--- a/fs/ntfs/collate.c	2004-10-18 21:54:55.000000000 +0000
+++ b/fs/ntfs/collate.c	2004-12-04 13:25:02.000000000 +0000
@@ -109,7 +109,6 @@
  	 */
  	BUG_ON(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG);
  	i = le32_to_cpu(cr);
-	BUG_ON(i < 0);
  	if (i <= 0x02)
  		return ntfs_do_collate0x0[i](vol, data1, data1_len,
  				data2, data2_len);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2.6] clean-up: fixes "unsigned>=0" warning
@ 2004-12-06 20:48 Riina Kikas
  2004-12-06 21:03 ` Chris Friesen
  0 siblings, 1 reply; 6+ messages in thread
From: Riina Kikas @ 2004-12-06 20:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: mroos

This patch fixes warning "comparison of unsigned expression >= 0 is always true"
occuring on line 38

Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>

--- a/fs/ntfs/collate.h	2004-10-18 21:53:06.000000000 +0000
+++ b/fs/ntfs/collate.h	2004-12-04 13:26:03.000000000 +0000
@@ -37,7 +37,7 @@
  	if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG))
  		return FALSE;
  	i = le32_to_cpu(cr);
-	if (likely(((i >= 0) && (i <= 0x02)) ||
+	if (likely(cr <= 0x02 ||
  			((i >= 0x10) && (i <= 0x13))))
  		return TRUE;
  	return FALSE;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2.6] clean-up: fixes "unsigned<0" warning
@ 2004-12-06 20:59 Riina Kikas
  0 siblings, 0 replies; 6+ messages in thread
From: Riina Kikas @ 2004-12-06 20:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: mroos

This patch fixes warning "comparison of unsigned expression < 0 is always false"
occuring on line 711

Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>

--- a/drivers/ide/setup-pci.c	2004-11-30 19:43:52.000000000 +0000
+++ b/drivers/ide/setup-pci.c	2004-12-06 19:26:57.000000000 +0000
@@ -708,8 +708,7 @@
  	} else {
  		if (d->init_chipset)
  		{
-			if(d->init_chipset(dev, d->name) < 0)
-				return index;
+			d->init_chipset(dev, d->name)
  		}
  		if (noisy)
  #ifdef __sparc__

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6] clean-up: fixes "unsigned>=0" warning
  2004-12-06 20:48 [PATCH 2.6] clean-up: fixes "unsigned>=0" warning Riina Kikas
@ 2004-12-06 21:03 ` Chris Friesen
  2004-12-06 21:25   ` Riina Kikas
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Friesen @ 2004-12-06 21:03 UTC (permalink / raw)
  To: Riina Kikas; +Cc: linux-kernel, mroos

Riina Kikas wrote:
> This patch fixes warning "comparison of unsigned expression >= 0 is 
> always true"
> occuring on line 38
> 
> Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>
> 
> --- a/fs/ntfs/collate.h    2004-10-18 21:53:06.000000000 +0000
> +++ b/fs/ntfs/collate.h    2004-12-04 13:26:03.000000000 +0000
> @@ -37,7 +37,7 @@
>      if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG))
>          return FALSE;
>      i = le32_to_cpu(cr);
> -    if (likely(((i >= 0) && (i <= 0x02)) ||
> +    if (likely(cr <= 0x02 ||

Do we really want to be doing any operations on "cr", since it's not known what 
endianness of cpu we're on?

Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6] clean-up: fixes "unsigned>=0" warning
  2004-12-06 21:03 ` Chris Friesen
@ 2004-12-06 21:25   ` Riina Kikas
  0 siblings, 0 replies; 6+ messages in thread
From: Riina Kikas @ 2004-12-06 21:25 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linux-kernel, mroos

Seems that this one has been fixed somewhere between 2.6.8 and 2.6.9, so
it doesn't need to be fixed any more. Sorry for that.

Riina


On Mon, 6 Dec 2004, Chris Friesen wrote:

> Riina Kikas wrote:
>> This patch fixes warning "comparison of unsigned expression >= 0 is 
>> always true"
>> occuring on line 38
>> 
>> Signed-off-by: Riina Kikas <Riina.Kikas@mail.ee>
>> 
>> --- a/fs/ntfs/collate.h    2004-10-18 21:53:06.000000000 +0000
>> +++ b/fs/ntfs/collate.h    2004-12-04 13:26:03.000000000 +0000
>> @@ -37,7 +37,7 @@
>>      if (unlikely(cr != COLLATION_BINARY && cr != 
>> COLLATION_NTOFS_ULONG))
>>          return FALSE;
>>      i = le32_to_cpu(cr);
>> -    if (likely(((i >= 0) && (i <= 0x02)) ||
>> +    if (likely(cr <= 0x02 ||
>
> Do we really want to be doing any operations on "cr", since it's not 
> known what endianness of cpu we're on?
>
> Chris
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-12-06 21:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-06 20:48 [PATCH 2.6] clean-up: fixes "unsigned>=0" warning Riina Kikas
2004-12-06 21:03 ` Chris Friesen
2004-12-06 21:25   ` Riina Kikas
  -- strict thread matches above, loose matches on Subject: below --
2004-12-06 20:59 [PATCH 2.6] clean-up: fixes "unsigned<0" warning Riina Kikas
2004-12-06 20:47 Riina Kikas
2004-12-06 20:44 Riina Kikas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox