drm/gma500: oaktrail lvds cleanup fixes
Subsystems (3)
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.
--- drivers/gpu/drm/gma500/oaktrail_lvds.c | 4 +++- drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/oaktrail_lvds.c +3 -1
@@ -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 ) {
drivers/gpu/drm/gma500/psb_intel_lvds.c +5 -1
@@ -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);
Signature · 6 lines
1.8.5.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Jan Safrata
Fixes to allow removal of
gma500_gfxmodule (after frame buffer console unbind) when used with Atom E6xx gpu chipset.The
oaktrail_lvds_init()usesi2c_adaponly to read edid and therefore it should calli2c_put_adapter()after. Added the missing call.The
psb_intel_lvds_destroy()is shared for multiple chipsets cleanup, but there is definedddc_busmember
in different lower level structures - in case of oaktrail lvds it isgma_encoder->ddc_businstead oflvds_priv->ddc_bus. In case of oaktrail lvds thegma_encoder->ddc_buswas not destroyed. This patch adds the missing call ofpsb_intel_i2c_destroy()and avoids the NULL pointer dereference oflvds_privwhich is not used in case of oaktrail lvds.
Quoted 4 lines
Tested on SECO QuadMo747-E6xx-EXTREME Qseven platform.
Signed-off-by Jan Safrata <[email protected]>Cc Patrik Jakobsson <[email protected]>
Quoted 40 lines
--- drivers/gpu/drm/gma500/oaktrail_lvds.c | 4 +++- drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/gma500/oaktrail_lvds.c +3
-1@@ -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 ) {drivers/gpu/drm/gma500/psb_intel_lvds.c +5
-2@@ -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); --
Quoted 2 lines
1.8.5.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel