Skip to contentSkip to conversation

drivers/block/cciss.c (2.6.35.7): Fixed useless compile warning

PATCH In review Poyo VL 3 participants 3 messages Sep 20, 2010 – Sep 21, 2010

Subsystems (2)
lore
Share & tools
lore

Poyo VL

author
#0 lore raw

PATCH 1/1 drivers/block/cciss.c (2.6.35.7): Fixed useless compile warning

I am sorry if I sent this wrong, but someone told me to send this to this e-mail adress.
There isn't practically any problem, but the compiler can't know that, because sn is initialized in a conditional expression (else return snprintf(...)...), and it throws those ugly warnings:
drivers/block/cciss.c: In function ‘dev_show_unique_id’:
drivers/block/cciss.c:564:7: warning: ‘sn[0]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[1]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[2]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[3]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[4]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[5]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[6]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[7]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[8]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[9]’ may be used uninitialized in this function
drivers/block/cciss.c:564:7: warning: ‘sn[10]’ may be used uninitialized in this

function
drivers/block/cciss.c:564:7: warning: ‘sn[11]’ may be used uninitialized in this

function
drivers/block/cciss.c:564:7: warning: ‘sn[12]’ may be used uninitialized in this

function
drivers/block/cciss.c:564:7: warning: ‘sn[13]’ may be used uninitialized in this

function
drivers/block/cciss.c:564:7: warning: ‘sn[14]’ may be used uninitialized in this

function
drivers/block/cciss.c:564:7: warning: ‘sn[15]’ may be used uninitialized in this

function
Just have to initialize sn[] with 0. It is practically useless, but the compiler

wan't throw that warnings anymore.
Patch downer. Thanks.

---

drivers/block/cciss.c 2010-09-13 19:54:58.000000000 +0300 renamed from drivers/block/cciss.c 2010-09-17 20:17:49.844010958 +0300 +0 -0
@@ -561,7 +561,7 @@ static ssize_t dev_show_unique_id(struct
{
     drive_info_struct *drv = to_drv(dev);
     struct ctlr_info *h = to_hba(drv->dev.parent);
-    __u8 sn[16] = {0};
+    __u8 sn[16];
     unsigned long flags;
     int ret = 0;
#1 lore raw

Re: [PATCH] drivers/block/cciss.c (2.6.35.7): Fixed useless

Which version of gcc are you using? It doesn't print any error message for me on version 4.3.2 (which is really old).

The idea is fine but the patch is all messed up. First of all the it's reversed. It says '+' where it should say '-' and '-' where it should say '+'.

Also your mail client has completely mangled it. It has removed spaces from the start of lines and changed the tabs to spaces. Please read Documentation/email-clients.txt and send an email to yourself. Save the email as raw text. cat email.txt | patch -p1.

When that works resend it. Add these people to the CC list:

Mike Miller <[email protected]>
Jens Axboe <[email protected]>
"Stephen M. Cameron" <[email protected]> [email protected]

Also you don't need to copy all 16 lines of error messages. Just a couple will do. But do say which version of gcc you are using.

regards,
dan carpenter

#2 lore raw

Re: [PATCH] drivers/block/cciss.c (2.6.35.7): Fixed useless compile

In reply to Poyo VL

please CC: [email protected] also
so the criss develloper see it.

re,
wh

Quoted 32 lines · Dan Carpenter

Which version of gcc are you using? It doesn't print any error message for me on version 4.3.2 (which is really old).

The idea is fine but the patch is all messed up. First of all the it's reversed. It says '+' where it should say '-' and '-' where it should say '+'.

Also your mail client has completely mangled it. It has removed spaces from the start of lines and changed the tabs to spaces. Please read Documentation/email-clients.txt and send an email to yourself. Save the email as raw text. cat email.txt | patch -p1.

When that works resend it. Add these people to the CC list:

Mike Miller <[email protected]>
Jens Axboe <[email protected]>
"Stephen M. Cameron" <[email protected]> [email protected]

Also you don't need to copy all 16 lines of error messages. Just a couple will do. But do say which version of gcc you are using.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html