Skip to contentSkip to conversation

build warning in radeon/atombios_crtc.c: pll' may be used uninitialized

PATCH In review Stefan Richter 2 participants 4 messages May 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

seen with gcc 4.3.4 in current git (although 2.6.34 should show that too):

drivers/gpu/drm/radeon/atombios_crtc.c: In function 'atombios_crtc_set_pll':
drivers/gpu/drm/radeon/atombios_crtc.c:684: warning: 'pll' may be used uninitialized in this function

It seems to require a 'make CONFIG_DEBUG_SECTION_MISMATCH=y' to trigger this warning; don't know why.

Perhaps add a 'default:' case to the switch block?

Signature · 3 lines
Stefan Richter
-=====-==-=- -=-= ==--=
http://arcgraph.de/sr/
#1 lore raw
Quoted 5 lines · Stefan Richter

Hi,

seen with gcc 4.3.4 in current git (although 2.6.34 should show that too):

Quoted 7 lines

drivers/gpu/drm/radeon/atombios_crtc.c: In function 'atombios_crtc_set_pll':
drivers/gpu/drm/radeon/atombios_crtc.c:684: warning: 'pll' may be used uninitialized in this function

It seems to require a 'make CONFIG_DEBUG_SECTION_MISMATCH=y' to trigger this warning; don't know why.

Perhaps add a 'default:' case to the switch block?

Adding a default to the last case should be fine.

Alex

Quoted 6 lines

--
Stefan Richter
-=====-==-=- -=-= ==--=
http://arcgraph.de/sr/

#2 lore raw

PATCH 1/1 drm/radeon/kms: suppress a build warning (unused variable)

At least 'make CONFIG_DEBUG_SECTION_MISMATCH=y' causes
drivers/gpu/drm/radeon/atombios_crtc.c: In function 'atombios_crtc_set_pll':
drivers/gpu/drm/radeon/atombios_crtc.c:684: warning: 'pll' may be used uninitialized in this function
which has the looks of a falso positive.

Add a default: case so that gcc rests assured that all possible pll_id's are covered. Keep the present cases that fall through to the default one for self-documentation.

---
 drivers/gpu/drm/radeon/atombios_crtc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +1 -0
index 03dd6c4..f3f2827 100644
@@ -707,6 +707,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
 		break;
 	case ATOM_DCPLL:
 	case ATOM_PPLL_INVALID:
+	default:
 		pll = &rdev->clock.dcpll;
 		break;
 	}
Signature · 3 lines
Stefan Richter
-=====-==-=- -=-= ==--=
http://arcgraph.de/sr/
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] drm/radeon/kms: suppress a build warning (unused variable)

Quoted 9 lines · Stefan Richter

At least 'make CONFIG_DEBUG_SECTION_MISMATCH=y' causes drivers/gpu/drm/radeon/atombios_crtc.c: In function 'atombios_crtc_set_pll':
 drivers/gpu/drm/radeon/atombios_crtc.c:684: warning: 'pll' may be used uninitialized in this function which has the looks of a falso positive.

Add a default: case so that gcc rests assured that all possible pll_id's are covered. Keep the present cases that fall through to the default one for self-documentation.

looks good.

Quoted 22 lines

---
 drivers/gpu/drm/radeon/atombios_crtc.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +0 -0
index 03dd6c4..f3f2827 100644
@@ -707,6 +707,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
                break;

       case ATOM_DCPLL:
       case ATOM_PPLL_INVALID:
+       default:
               pll = &rdev->clock.dcpll;
               break;
       }
--
Stefan Richter
-=====-==-=- -=-= ==--=
http://arcgraph.de/sr/