All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i915: silence gcc warnings with CONFIG_BUG disabled
@ 2011-07-01  4:36 Darren Hart
  0 siblings, 0 replies; only message in thread
From: Darren Hart @ 2011-07-01  4:36 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Darren Hart, Eric Anholt

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@linux.intel.com>
CC: Eric Anholt <eric@anholt.net>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-01  4:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-01  4:36 [PATCH] i915: silence gcc warnings with CONFIG_BUG disabled Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.