summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2015-01-21 13:50:54 +0000
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-21 14:54:49 +0100
commite9413c76eb4c990bd3882d2c2ad1f228819b4e7d (patch)
treeaca1434bd6f4aead6dd95aa00c1c7ced31e5d3ae
parentb13c8f920cdf616fa5afbc8f0b9e3bc545eb02c8 (diff)
drm/i915: Fix kzalloc() smatch warnings in get_initial_plane_config()
Smatch doesn't like: struct drm_framebuffer *fb; fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL); and warns with: warn: struct type mismatch 'drm_framebuffer vs intel_framebuffer' This implicit cast was correct as struct intel_framebuffer has struct drm_framebuffer as its first member, but in case someone want to reorder the fields for some reason, it's slightly safer to access the underlying drm_framebuffer through intel_fb->base. Also, having fewer static analysis warnings is a worthy goal. Cc: kbuild@01.org Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 92c2a8797ce0..f4d54bed700c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6584,13 +6584,16 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
int fourcc, pixel_format;
int aligned_height;
struct drm_framebuffer *fb;
+ struct intel_framebuffer *intel_fb;
- fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
- if (!fb) {
+ intel_fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
+ if (!intel_fb) {
DRM_DEBUG_KMS("failed to alloc fb\n");
return;
}
+ fb = &intel_fb->base;
+
val = I915_READ(DSPCNTR(plane));
if (INTEL_INFO(dev)->gen >= 4)
@@ -7613,13 +7616,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
int fourcc, pixel_format;
int aligned_height;
struct drm_framebuffer *fb;
+ struct intel_framebuffer *intel_fb;
- fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
- if (!fb) {
+ intel_fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
+ if (!intel_fb) {
DRM_DEBUG_KMS("failed to alloc fb\n");
return;
}
+ fb = &intel_fb->base;
+
val = I915_READ(PLANE_CTL(pipe, 0));
if (val & PLANE_CTL_TILED_MASK)
plane_config->tiling = I915_TILING_X;
@@ -7706,13 +7712,16 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
int fourcc, pixel_format;
int aligned_height;
struct drm_framebuffer *fb;
+ struct intel_framebuffer *intel_fb;
- fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
- if (!fb) {
+ intel_fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
+ if (!intel_fb) {
DRM_DEBUG_KMS("failed to alloc fb\n");
return;
}
+ fb = &intel_fb->base;
+
val = I915_READ(DSPCNTR(pipe));
if (INTEL_INFO(dev)->gen >= 4)