mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Darren Hart <dvhart@linux.intel.com>, Eric Anholt <eric@anholt.net>
Subject: [PATCH] i915: silence gcc warnings with CONFIG_BUG disabled
Date: Thu, 30 Jun 2011 21:36:14 -0700	[thread overview]
Message-ID: <1356458e54b6de3c2ae4bea7744f3ddd85bce0cc.1309494974.git.dvhart@linux.intel.com> (raw)

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


                 reply	other threads:[~2011-07-01  4:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356458e54b6de3c2ae4bea7744f3ddd85bce0cc.1309494974.git.dvhart@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®