Commit 84d1c9b4 authored by Johan Hovold's avatar Johan Hovold Committed by Patrik Jakobsson
Browse files

drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init



The LVDS init code looks up an I2C adapter using i2c_get_adapter() and
tries to read the EDID before falling back to allocating and registering
its own adapter.

Make sure to drop the references taken by i2c_get_adapter() when falling
back to allocating an adapter as well as on late errors to allow the
looked up adapter to be deregistered.

Fixes: 1b082ccf ("gma500: Add Oaktrail support")
Cc: stable@vger.kernel.org	# 3.3
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patch.msgid.link/20260508144446.59722-4-johan@kernel.org
parent 657a091a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -367,6 +367,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
	if (edid == NULL && dev_priv->lpc_gpio_base) {
		ddc_bus = oaktrail_lvds_i2c_init(dev);
		if (!IS_ERR(ddc_bus)) {
			if (i2c_adap)
				i2c_put_adapter(i2c_adap);
			i2c_adap = &ddc_bus->base;
			edid = drm_get_edid(connector, i2c_adap);
		}
@@ -423,6 +425,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
	mutex_unlock(&dev->mode_config.mutex);
	if (!IS_ERR_OR_NULL(ddc_bus))
		gma_i2c_destroy(ddc_bus);
	else if (i2c_adap)
		i2c_put_adapter(i2c_adap);
	drm_encoder_cleanup(encoder);
err_connector_cleanup:
	drm_connector_cleanup(connector);