drm/i915/sdvo: Fix harmless build warning
Subsystems (2)
PATCH 1/1 drm/i915/sdvo: Fix harmless build warning
Removing the following harmless build warning to let compiler happy.
drivers/gpu/drm/i915/intel_sdvo.c: In function 'intel_sdvo_mode_set':drivers/gpu/drm/i915/intel_sdvo.c:1097: warning: 'rate' may be used uninitialized in this function
--- drivers/gpu/drm/i915/intel_sdvo.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +2 -1
@@ -1170,7 +1170,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,switch (sdvo_pixel_multiply) {case 1 : rate =SDVO_CLOCK_RATE_MULT_1X ;break ;case 2 : rate =SDVO_CLOCK_RATE_MULT_2X ;break ; -case 4 : rate =SDVO_CLOCK_RATE_MULT_4X ;break ; +case 4 : +default : rate =SDVO_CLOCK_RATE_MULT_4X ; }if (!intel_sdvo_set_clock_rate_mult (intel_sdvo, rate))return ;
Signature · 1 line
1.6.0.4
drivers/gpu/drm/i915/intel_sdvo.c static void intel_sdvo_mode_set(struct drm_encoder *encoder, · line 1177
Quoted 12 lines · Dongdong Deng
Removing the following harmless build warning to let compiler happy.
drivers/gpu/drm/i915/intel_sdvo.c +2
-1@@ -1170,7 +1170,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,switch (sdvo_pixel_multiply) {case 1 : rate =SDVO_CLOCK_RATE_MULT_1X ;break ;case 2 : rate =SDVO_CLOCK_RATE_MULT_2X ;break ; -case 4 : rate =SDVO_CLOCK_RATE_MULT_4X ;break ; +case 4 : +default : rate =SDVO_CLOCK_RATE_MULT_4X ; }if (!intel_sdvo_set_clock_rate_mult (intel_sdvo, rate))return ;
Even if the default case can not trigger, is 4x a good default multiplier?
Also, shouldn't there be a break; also in the default: case?
//Peter
Quoted 16 lines · Peter Stuge
drivers/gpu/drm/i915/intel_sdvo.c static void intel_sdvo_mode_set(struct drm_encoder *encoder, · line 1177
Quoted 12 lines · Dongdong Deng
Removing the following harmless build warning to let compiler happy.
drivers/gpu/drm/i915/intel_sdvo.c +2
-1@@ -1170,7 +1170,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,switch (sdvo_pixel_multiply) {case 1 : rate =SDVO_CLOCK_RATE_MULT_1X ;break ;case 2 : rate =SDVO_CLOCK_RATE_MULT_2X ;break ; -case 4 : rate =SDVO_CLOCK_RATE_MULT_4X ;break ; +case 4 : +default : rate =SDVO_CLOCK_RATE_MULT_4X ; }if (!intel_sdvo_set_clock_rate_mult (intel_sdvo, rate))return ;Even if the default case can not trigger, is 4x a good default multiplier?
Quoted 1 line
Also, shouldn't there be a break; also in the default: case?
Hello Peter,
In the last maintree, the warning have gone with following changing. :-)
switch (pixel_multiplier) {
default:
case 1: rate = SDVO_CLOCK_RATE_MULT_1X; break;
case 2: rate = SDVO_CLOCK_RATE_MULT_2X; break;
case 4: rate = SDVO_CLOCK_RATE_MULT_4X; break;
}Thanks,
Dongdong
Quoted 4 lines
//Peter