aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2010-01-11 16:42:21 -0500
committerBen Skeggs <bskeggs@redhat.com>2010-01-14 18:28:48 -0500
commitc8ebe275790f2c5efc3ffec515c93b7a139829d3 (patch)
tree82093fe7938d881555112d939a04627292d71233 /drivers
parent3d9aefb8bd1be2b5e07acf0f938c21769f03cc64 (diff)
drm/nouveau: fix edid memleak in nouveau_connector
This was spotted by kmemleak. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 5a10deb8bdbd..54c85305a0fb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -83,14 +83,16 @@ nouveau_encoder_connector_get(struct nouveau_encoder *encoder)
83static void 83static void
84nouveau_connector_destroy(struct drm_connector *drm_connector) 84nouveau_connector_destroy(struct drm_connector *drm_connector)
85{ 85{
86 struct nouveau_connector *connector = nouveau_connector(drm_connector); 86 struct nouveau_connector *nv_connector =
87 struct drm_device *dev = connector->base.dev; 87 nouveau_connector(drm_connector);
88 struct drm_device *dev = nv_connector->base.dev;
88 89
89 NV_DEBUG_KMS(dev, "\n"); 90 NV_DEBUG_KMS(dev, "\n");
90 91
91 if (!connector) 92 if (!nv_connector)
92 return; 93 return;
93 94
95 kfree(nv_connector->edid);
94 drm_sysfs_connector_remove(drm_connector); 96 drm_sysfs_connector_remove(drm_connector);
95 drm_connector_cleanup(drm_connector); 97 drm_connector_cleanup(drm_connector);
96 kfree(drm_connector); 98 kfree(drm_connector);
@@ -237,6 +239,9 @@ nouveau_connector_detect(struct drm_connector *connector)
237 return connector_status_connected; 239 return connector_status_connected;
238 } 240 }
239 241
242 kfree(nv_connector->edid);
243 nv_connector->edid = NULL;
244
240 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder); 245 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
241 if (i2c) { 246 if (i2c) {
242 nouveau_connector_ddc_prepare(connector, &flags); 247 nouveau_connector_ddc_prepare(connector, &flags);
@@ -687,8 +692,12 @@ nouveau_connector_create_lvds(struct drm_device *dev,
687 */ 692 */
688 if (!nv_connector->edid && !nv_connector->native_mode && 693 if (!nv_connector->edid && !nv_connector->native_mode &&
689 !dev_priv->VBIOS.pub.fp_no_ddc) { 694 !dev_priv->VBIOS.pub.fp_no_ddc) {
690 nv_connector->edid = 695 struct edid *edid =
691 (struct edid *)nouveau_bios_embedded_edid(dev); 696 (struct edid *)nouveau_bios_embedded_edid(dev);
697 if (edid) {
698 nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
699 *(nv_connector->edid) = *edid;
700 }
692 } 701 }
693 702
694 if (!nv_connector->edid) 703 if (!nv_connector->edid)