drm/i915: Fix memory leak in intel_dsi_init() error path
Subsystems (2)
PATCH 1/1 drm/i915: Fix memory leak in intel_dsi_init() error path
intel_dsi_init() bails out without freeing the memory 'intel_dsi' and 'intel_connector' point to. Simply bail out before allocating memory.
Picked up by Coverity - CID 1222750.
Signed-off-by Christoph Jaeger <[email protected]>
--- drivers/gpu/drm/i915/intel_dsi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +7 -7
@@ -675,6 +675,13 @@ bool intel_dsi_init(struct drm_device *dev)if (!dev_priv->vbt.has_mipi)return false; +if (IS_VALLEYVIEW (dev)) { + dev_priv->mipi_mmio_base =VLV_MIPI_BASE ; + }else { +DRM_ERROR ("Unsupported Mipi device to reg base" ); +return false; + } + intel_dsi =kzalloc (sizeof (*intel_dsi),GFP_KERNEL );if (!intel_dsi)return false;
@@ -689,13 +696,6 @@ bool intel_dsi_init(struct drm_device *dev) encoder = &intel_encoder->base; intel_dsi->attached_connector = intel_connector; -if (IS_VALLEYVIEW (dev)) { - dev_priv->mipi_mmio_base =VLV_MIPI_BASE ; - }else { -DRM_ERROR ("Unsupported Mipi device to reg base" ); -return false; - } - connector = &intel_connector->base;drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI );
Signature · 1 line
1.9.3
Quoted 6 lines · Christoph Jaeger
intel_dsi_init()bails out without freeing the memory 'intel_dsi' and 'intel_connector' point to. Simply bail out before allocating memory.Picked up by Coverity - CID 1222750.
Signed-off-by Christoph Jaeger <[email protected]>
Queued for -next, thanks for the patch. I've had to rebase the patch a bit to resolve conflicts. Imo also not for -fixes because of this conflict potential, so will land in 3.17.
-Daniel
Quoted 39 lines
--- drivers/gpu/drm/i915/intel_dsi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +7
-7@@ -675,6 +675,13 @@ bool intel_dsi_init(struct drm_device *dev)if (!dev_priv->vbt.has_mipi)return false; +if (IS_VALLEYVIEW (dev)) { + dev_priv->mipi_mmio_base =VLV_MIPI_BASE ; + }else { +DRM_ERROR ("Unsupported Mipi device to reg base" ); +return false; + } + intel_dsi =kzalloc (sizeof (*intel_dsi),GFP_KERNEL );if (!intel_dsi)return false;@@ -689,13 +696,6 @@ bool intel_dsi_init(struct drm_device *dev) encoder = &intel_encoder->base; intel_dsi->attached_connector = intel_connector; -if (IS_VALLEYVIEW (dev)) { - dev_priv->mipi_mmio_base =VLV_MIPI_BASE ; - }else { -DRM_ERROR ("Unsupported Mipi device to reg base" ); -return false; - } - connector = &intel_connector->base;drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI );Signature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch