[PATCH] i915: silence gcc warnings with CONFIG_BUG disabled

From: Darren Hart
Date: Fri Jul 01 2011 - 00:36:42 EST


With CONFIG_BUG disabled, gcc issues the following warnings:

drivers/gpu/drm/i915/intel_display.c:773: warning: âstate_stringâ defined but not used
drivers/gpu/drm/i915/intel_display.c: In function âintel_pin_and_fence_fb_objâ:
drivers/gpu/drm/i915/intel_display.c:1790: warning: âalignmentâ may be used uninitialized in this function

Fix the "state_string()" error with a __maybe_unused tag.

Fix the "alignment" error by assigning it to 0 in the default case,
this avoids an unecessary initialization in the common case.

Signed-off-by: Darren Hart <dvhart@xxxxxxxxxxxxxxx>
CC: Eric Anholt <eric@xxxxxxxxxx>
---
drivers/gpu/drm/i915/intel_display.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 21b6f93..adf483e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -770,7 +770,7 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
}
}

-static const char *state_string(bool enabled)
+static __maybe_unused const char *state_string(bool enabled)
{
return enabled ? "on" : "off";
}
@@ -1808,6 +1808,8 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,
DRM_ERROR("Y tiled not allowed for scan out buffers\n");
return -EINVAL;
default:
+ /* silence gcc uninitialized warnings with CONFIG_BUG not set */
+ alignment = 0;
BUG();
}

--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/