linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-core: disable uninitialized var warning
@ 2012-12-20 14:10 Dirk Behme
  2012-12-20 14:14 ` Dirk Behme
  0 siblings, 1 reply; 3+ messages in thread
From: Dirk Behme @ 2012-12-20 14:10 UTC (permalink / raw)
  To: linux-ide; +Cc: Dirk Behme, Jeff Garzik

Make GCC happy by disabling the warning

drivers/ata/libata-core.c: In function 'ata_hpa_resize':
drivers/ata/libata-core.c:1394:3: warning: 'native_sectors' may be used uninitialized in this function [-Wmaybe-uninitialized]

Looking on the code, 'native_sectors' is always initialized by calling
ata_read_native_max_address(dev, &native_sectors).

Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
CC: Jeff Garzik <jgarzik@pobox.com>
---
 drivers/ata/libata-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9e8b99a..21623cf 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1324,7 +1324,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 	int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
 	bool unlock_hpa = ata_ignore_hpa || dev->flags & ATA_DFLAG_UNLOCK_HPA;
 	u64 sectors = ata_id_n_sectors(dev->id);
-	u64 native_sectors;
+	u64 native_sectors = 0 /* GCC */;
 	int rc;
 
 	/* do we need to do it? */
-- 
1.7.10.4


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

* Re: [PATCH] libata-core: disable uninitialized var warning
  2012-12-20 14:10 [PATCH] libata-core: disable uninitialized var warning Dirk Behme
@ 2012-12-20 14:14 ` Dirk Behme
  2012-12-20 14:42   ` Dirk Behme
  0 siblings, 1 reply; 3+ messages in thread
From: Dirk Behme @ 2012-12-20 14:14 UTC (permalink / raw)
  To: linux-ide; +Cc: Jeff Garzik

Am 20.12.2012 15:10, schrieb Dirk Behme:
> Make GCC happy by disabling the warning
>
> drivers/ata/libata-core.c: In function 'ata_hpa_resize':
> drivers/ata/libata-core.c:1394:3: warning: 'native_sectors' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> Looking on the code, 'native_sectors' is always initialized by calling
> ata_read_native_max_address(dev, &native_sectors).
>
> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
> CC: Jeff Garzik <jgarzik@pobox.com>

Ah, sorry, just saw that there is already a similar discussion from 
today. Seems this didn't make it to Google, yet ;)

Dirk

> ---
>   drivers/ata/libata-core.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 9e8b99a..21623cf 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -1324,7 +1324,7 @@ static int ata_hpa_resize(struct ata_device *dev)
>   	int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
>   	bool unlock_hpa = ata_ignore_hpa || dev->flags & ATA_DFLAG_UNLOCK_HPA;
>   	u64 sectors = ata_id_n_sectors(dev->id);
> -	u64 native_sectors;
> +	u64 native_sectors = 0 /* GCC */;
>   	int rc;
>
>   	/* do we need to do it? */
>


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

* Re: [PATCH] libata-core: disable uninitialized var warning
  2012-12-20 14:14 ` Dirk Behme
@ 2012-12-20 14:42   ` Dirk Behme
  0 siblings, 0 replies; 3+ messages in thread
From: Dirk Behme @ 2012-12-20 14:42 UTC (permalink / raw)
  To: linux-ide; +Cc: Jeff Garzik

Am 20.12.2012 15:14, schrieb Dirk Behme:
> Am 20.12.2012 15:10, schrieb Dirk Behme:
>> Make GCC happy by disabling the warning
>>
>> drivers/ata/libata-core.c: In function 'ata_hpa_resize':
>> drivers/ata/libata-core.c:1394:3: warning: 'native_sectors' may be
>> used uninitialized in this function [-Wmaybe-uninitialized]
>>
>> Looking on the code, 'native_sectors' is always initialized by calling
>> ata_read_native_max_address(dev, &native_sectors).
>>
>> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
>> CC: Jeff Garzik <jgarzik@pobox.com>
>
> Ah, sorry, just saw that there is already a similar discussion from
> today. Seems this didn't make it to Google, yet ;)

Btw, regarding the "better to file a gcc bug report" in the previous 
thread:

Yes, agreed.

But looking at

http://lwn.net/Articles/529963/

there seem to be ~185 places in the kernel which don't want to wait 
for the GCC to be fixed.

Best regards

Dirk

>> ---
>>   drivers/ata/libata-core.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
>> index 9e8b99a..21623cf 100644
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>> @@ -1324,7 +1324,7 @@ static int ata_hpa_resize(struct ata_device *dev)
>>       int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
>>       bool unlock_hpa = ata_ignore_hpa || dev->flags &
>> ATA_DFLAG_UNLOCK_HPA;
>>       u64 sectors = ata_id_n_sectors(dev->id);
>> -    u64 native_sectors;
>> +    u64 native_sectors = 0 /* GCC */;
>>       int rc;
>>
>>       /* do we need to do it? */
>>
>


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

end of thread, other threads:[~2012-12-20 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 14:10 [PATCH] libata-core: disable uninitialized var warning Dirk Behme
2012-12-20 14:14 ` Dirk Behme
2012-12-20 14:42   ` Dirk Behme

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