All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: aic94xx: fix uninitialized variable warning
@ 2010-05-27 18:24 Prarit Bhargava
  2010-05-28 19:18 ` Rolf Eike Beer
  0 siblings, 1 reply; 3+ messages in thread
From: Prarit Bhargava @ 2010-05-27 18:24 UTC (permalink / raw)
  To: linux-scsi, James.Bottomley; +Cc: Prarit Bhargava

Fixes warning:

drivers/scsi/aic94xx/aic94xx_sds.c: In function ‘asd_process_ctrl_a_user’:
drivers/scsi/aic94xx/aic94xx_sds.c:985: error: ‘offs’ may be used uninitialized in this function

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..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;
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH]: aic94xx: fix uninitialized variable warning
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Rolf Eike Beer @ 2010-05-28 19:18 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: linux-scsi, James.Bottomley

[-- Attachment #1: Type: Text/Plain, Size: 1064 bytes --]

Prarit Bhargava wrote:
> Fixes warning:
> 
> drivers/scsi/aic94xx/aic94xx_sds.c: In function
> ‘asd_process_ctrl_a_user’: drivers/scsi/aic94xx/aic94xx_sds.c:985:
> error: ‘offs’ may be used uninitialized in this function

Your mailer has messed this up as it did not declare any character set. This 
was probably UTF8 or something like that.

> 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.

Eike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH]: aic94xx: fix uninitialized variable warning
  2010-05-28 19:18 ` Rolf Eike Beer
@ 2010-06-07 18:52   ` Prarit Bhargava
  0 siblings, 0 replies; 3+ messages in thread
From: Prarit Bhargava @ 2010-06-07 18:52 UTC (permalink / raw)
  To: linux-scsi, James.Bottomley; +Cc: Rolf Eike Beer


> 
>> 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;

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

end of thread, other threads:[~2010-06-07 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.