From: Gabriel C <nix.or.die@googlemail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Subject: drivers/mtd/devices/doc2000.c - address of 'eccbuf' will always evaluate as 'true' , warnings
Date: Sun, 22 Jul 2007 14:13:26 +0200 [thread overview]
Message-ID: <46A349E6.3030207@googlemail.com> (raw)
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;
next reply other threads:[~2007-07-22 12:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-22 12:13 Gabriel C [this message]
2007-07-22 19:34 ` drivers/mtd/devices/doc2000.c - address of 'eccbuf' will always evaluate as 'true' , warnings Jörn Engel
2007-07-22 20:29 ` Gabriel C
2007-07-22 20:43 ` Jörn Engel
2007-07-22 22:44 ` Gabriel C
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=46A349E6.3030207@googlemail.com \
--to=nix.or.die@googlemail.com \
--cc=dwmw2@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox