Skip to content

Commit 4e003e2

Browse files
jhovoldgregkh
authored andcommitted
drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init
commit 84d1c9b416d54afe760ca4c378bd95c89261254c upstream. 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: 1b082cc ("gma500: Add Oaktrail support") Cc: stable@vger.kernel.org # 3.3 Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Link: https://patch.msgid.link/20260508144446.59722-4-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ab92569 commit 4e003e2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/gpu/drm/gma500/oaktrail_lvds.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
366366
if (edid == NULL && dev_priv->lpc_gpio_base) {
367367
ddc_bus = oaktrail_lvds_i2c_init(dev);
368368
if (!IS_ERR(ddc_bus)) {
369+
if (i2c_adap)
370+
i2c_put_adapter(i2c_adap);
369371
i2c_adap = &ddc_bus->base;
370372
edid = drm_get_edid(connector, i2c_adap);
371373
}
@@ -422,6 +424,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
422424
mutex_unlock(&dev->mode_config.mutex);
423425
if (!IS_ERR_OR_NULL(ddc_bus))
424426
gma_i2c_destroy(ddc_bus);
427+
else if (i2c_adap)
428+
i2c_put_adapter(i2c_adap);
425429
drm_encoder_cleanup(encoder);
426430
err_connector_cleanup:
427431
drm_connector_cleanup(connector);

0 commit comments

Comments
 (0)