Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733073 > unrolled thread

[PATCH] drm/radeon: properly initialize r600_audio_status() data

Started byArnd Bergmann <arnd@arndb.de>
First post2017-09-15 22:10 +0200
Last post2017-09-19 05:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/radeon: properly initialize r600_audio_status() data Arnd Bergmann <arnd@arndb.de> - 2017-09-15 22:10 +0200
    Re: [PATCH] drm/radeon: properly initialize r600_audio_status() data Christian König <ckoenig.leichtzumerken@gmail.com> - 2017-09-16 14:30 +0200
      Re: [PATCH] drm/radeon: properly initialize r600_audio_status() data Alex Deucher <alexdeucher@gmail.com> - 2017-09-19 05:00 +0200

#1733073 — [PATCH] drm/radeon: properly initialize r600_audio_status() data

FromArnd Bergmann <arnd@arndb.de>
Date2017-09-15 22:10 +0200
Subject[PATCH] drm/radeon: properly initialize r600_audio_status() data
Message-ID<uq561-7Oa-17@gated-at.bofh.it>
The structure returned from r600_audio_status() is only partially
initialized, and older gcc versions (4.3 and 4.4) warn about this:

drivers/gpu/drm/radeon/r600_hdmi.c: In function 'r600_audio_status':
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.id' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.connected' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.offset' is used uninitialized in this function

This is harmless and surprisingly correct in C99, as the caller
only accesses the fields that got initialized, so newer compilers
don't warn about it, but initializing the entire structure feels
like the right thing to do here and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/radeon/r600_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index e82a99cb2459..ab32830c4e23 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -58,7 +58,7 @@ enum r600_hdmi_iec_status_bits {
 
 static struct r600_audio_pin r600_audio_status(struct radeon_device *rdev)
 {
-	struct r600_audio_pin status;
+	struct r600_audio_pin status = {};
 	uint32_t value;
 
 	value = RREG32(R600_AUDIO_RATE_BPS_CHANNEL);
-- 
2.9.0

[toc] | [next] | [standalone]


#1733274

FromChristian König <ckoenig.leichtzumerken@gmail.com>
Date2017-09-16 14:30 +0200
Message-ID<uqkoq-1sV-15@gated-at.bofh.it>
In reply to#1733073
Am 15.09.2017 um 22:06 schrieb Arnd Bergmann:
> The structure returned from r600_audio_status() is only partially
> initialized, and older gcc versions (4.3 and 4.4) warn about this:
>
> drivers/gpu/drm/radeon/r600_hdmi.c: In function 'r600_audio_status':
> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.id' is used uninitialized in this function
> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.connected' is used uninitialized in this function
> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.offset' is used uninitialized in this function
>
> This is harmless and surprisingly correct in C99, as the caller
> only accesses the fields that got initialized, so newer compilers
> don't warn about it, but initializing the entire structure feels
> like the right thing to do here and avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/radeon/r600_hdmi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
> index e82a99cb2459..ab32830c4e23 100644
> --- a/drivers/gpu/drm/radeon/r600_hdmi.c
> +++ b/drivers/gpu/drm/radeon/r600_hdmi.c
> @@ -58,7 +58,7 @@ enum r600_hdmi_iec_status_bits {
>   
>   static struct r600_audio_pin r600_audio_status(struct radeon_device *rdev)
>   {
> -	struct r600_audio_pin status;
> +	struct r600_audio_pin status = {};
>   	uint32_t value;
>   
>   	value = RREG32(R600_AUDIO_RATE_BPS_CHANNEL);

[toc] | [prev] | [next] | [standalone]


#1734619

FromAlex Deucher <alexdeucher@gmail.com>
Date2017-09-19 05:00 +0200
Message-ID<urgVr-6Lc-1@gated-at.bofh.it>
In reply to#1733274
On Sat, Sep 16, 2017 at 8:20 AM, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
> Am 15.09.2017 um 22:06 schrieb Arnd Bergmann:
>>
>> The structure returned from r600_audio_status() is only partially
>> initialized, and older gcc versions (4.3 and 4.4) warn about this:
>>
>> drivers/gpu/drm/radeon/r600_hdmi.c: In function 'r600_audio_status':
>> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.id' is used
>> uninitialized in this function
>> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.connected' is used
>> uninitialized in this function
>> drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.offset' is used
>> uninitialized in this function
>>
>> This is harmless and surprisingly correct in C99, as the caller
>> only accesses the fields that got initialized, so newer compilers
>> don't warn about it, but initializing the entire structure feels
>> like the right thing to do here and avoids the warning.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex


>
>> ---
>>   drivers/gpu/drm/radeon/r600_hdmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c
>> b/drivers/gpu/drm/radeon/r600_hdmi.c
>> index e82a99cb2459..ab32830c4e23 100644
>> --- a/drivers/gpu/drm/radeon/r600_hdmi.c
>> +++ b/drivers/gpu/drm/radeon/r600_hdmi.c
>> @@ -58,7 +58,7 @@ enum r600_hdmi_iec_status_bits {
>>     static struct r600_audio_pin r600_audio_status(struct radeon_device
>> *rdev)
>>   {
>> -       struct r600_audio_pin status;
>> +       struct r600_audio_pin status = {};
>>         uint32_t value;
>>         value = RREG32(R600_AUDIO_RATE_BPS_CHANNEL);
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web