lkml.org 
[lkml]   [2007]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectdrivers/mtd/devices/doc2000.c - address of 'eccbuf' will always evaluate as 'true' , warnings
Hi,

I noticed this warnings on current git with gcc 4.2.1

....

drivers/mtd/devices/doc2000.c: In function 'doc_read':
drivers/mtd/devices/doc2000.c:635: warning: the address of 'eccbuf' will always evaluate as 'true'
drivers/mtd/devices/doc2000.c: In function 'doc_write':
drivers/mtd/devices/doc2000.c:899: warning: the address of 'eccbuf' will always evaluate as 'true'

....

This patch fixes it but maybe there is a better way to do it.


Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
---


diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
index c73e96b..ce8fbf5 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
@@ -632,7 +632,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
len = ((from | 0x1ff) + 1) - from;

/* The ECC will not be calculated correctly if less than 512 is read */
- if (len != 0x200 && eccbuf)
+ if (len != 0x200 && eccbuf != NULL)
printk(KERN_WARNING
"ECC needs a full sector read (adr: %lx size %lx)\n",
(long) from, (long) len);
@@ -896,7 +896,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
/* Let the caller know we completed it */
*retlen += len;

- if (eccbuf) {
+ if (eccbuf != NULL) {
unsigned char x[8];
size_t dummy;
int ret;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-22 14:19    [W:0.083 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site