drm/gma500: oaktrail lvds cleanup fixes
Jan Safrata
jan.nikitenko at gmail.com
Thu Jan 15 06:10:05 PST 2015
Fixes to allow removal of gma500_gfx module (after frame buffer
console unbind) when used with Atom E6xx gpu chipset.
The oaktrail_lvds_init() uses i2c_adap only to read edid
and therefore it should call i2c_put_adapter() after.
Added the missing call.
The psb_intel_lvds_destroy() is shared for multiple
chipsets cleanup, but there is defined ddc_bus member
in different lower level structures - in case of oaktrail
lvds it is gma_encoder->ddc_bus instead of lvds_priv->ddc_bus.
In case of oaktrail lvds the gma_encoder->ddc_bus was not destroyed.
This patch adds the missing call of psb_intel_i2c_destroy()
and avoids the NULL pointer dereference of lvds_priv which is not
used in case of oaktrail lvds.
Tested on SECO QuadMo747-E6xx-EXTREME Qseven platform.
Signed-off-by: Jan Safrata <jan.nikitenko at gmail.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson at gmail.com>
---
drivers/gpu/drm/gma500/oaktrail_lvds.c | 4 +++-
drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 83bbc27..be26846 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -362,8 +362,10 @@ void oaktrail_lvds_init(struct drm_device *dev,
edid = NULL;
mutex_lock(&dev->mode_config.mutex);
i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus);
- if (i2c_adap)
+ if (i2c_adap) {
edid = drm_get_edid(connector, i2c_adap);
+ i2c_put_adapter(i2c_adap);
+ }
if (edid == NULL && dev_priv->lpc_gpio_base) {
oaktrail_lvds_i2c_init(encoder);
if (gma_encoder->ddc_bus != NULL) {
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 88aad95..71bae07 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -561,8 +561,12 @@ void psb_intel_lvds_destroy(struct drm_connector *connector)
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
- if (lvds_priv->ddc_bus)
+ if (lvds_priv && lvds_priv->ddc_bus)
psb_intel_i2c_destroy(lvds_priv->ddc_bus);
+ if (gma_encoder->ddc_bus) {
+ psb_intel_i2c_destroy(gma_encoder->ddc_bus);
+ gma_encoder->ddc_bus = NULL;
+ }
drm_connector_unregister(connector);
drm_connector_cleanup(connector);
kfree(connector);
--
1.8.5.5
More information about the dri-devel
mailing list