linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-scsi@vger.kernel.org, James.Bottomley@suse.de
Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
Subject: Re: [PATCH]: aic94xx: fix uninitialized variable warning
Date: Mon, 07 Jun 2010 14:52:44 -0400	[thread overview]
Message-ID: <4C0D3FFC.2030204@redhat.com> (raw)
In-Reply-To: <201005282118.08243.eike-kernel@sf-tec.de>


> 
>> diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c
>> b/drivers/scsi/aic94xx/aic94xx_sds.c index edb43fd..2f1751a 100644
>> --- a/drivers/scsi/aic94xx/aic94xx_sds.c
>> +++ b/drivers/scsi/aic94xx/aic94xx_sds.c
>> @@ -982,7 +982,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct
>> *asd_ha, struct asd_flash_dir *flash_dir)
>>  {
>>  	int err, i;
>> -	u32 offs, size;
>> +	u32 uninitialized_var(offs), size;
>>  	struct asd_ll_el *el;
>>  	struct asd_ctrla_phy_settings *ps;
>>  	struct asd_ctrla_phy_settings dflt_ps;
> 
> I would vote for putting the declarations if different lines if one of them 
> gets initialized or otherwise treated specially as it is otherwise hardly 
> readable.
> 

Thanks Eike,

New patch.



Fixes make -j24 CONFIG_DEBUG_SECTION_MISMATCH=y warning:

drivers/scsi/aic94xx/aic94xx_sds.c: In function "asd_process_ctrl_a_user":
drivers/scsi/aic94xx/aic94xx_sds.c:984: error: "offs" may be used uninitialized in this function

Fix an uninitialized variable warning.  A return value is checked elsewhere in
the function so this is safe to do.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>

diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c
index edb43fd..5a7978c 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -982,7 +982,8 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha,
 				   struct asd_flash_dir *flash_dir)
 {
 	int err, i;
-	u32 offs, size;
+	u32 uninitialized_var(offs);
+	u32 size;
 	struct asd_ll_el *el;
 	struct asd_ctrla_phy_settings *ps;
 	struct asd_ctrla_phy_settings dflt_ps;

      reply	other threads:[~2010-06-07 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 18:24 [PATCH]: aic94xx: fix uninitialized variable warning Prarit Bhargava
2010-05-28 19:18 ` Rolf Eike Beer
2010-06-07 18:52   ` Prarit Bhargava [this message]

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=4C0D3FFC.2030204@redhat.com \
    --to=prarit@redhat.com \
    --cc=James.Bottomley@suse.de \
    --cc=eike-kernel@sf-tec.de \
    --cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).