drm/bridge: sii902x: Fix audio codec unregistration
[ Upstream commit 3fc6c76a8d208d3955c9e64b382d0ff370bc61fc ]
The driver never unregisters the audio codec platform device, which can
lead to a crash on module reloading, nor does it handle the return value
from sii902x_audio_codec_init().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fixes: ff5781634c
("drm/bridge: sii902x: Implement HDMI audio support")
Cc: Jyri Sarha <jsarha@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240103-si902x-fixes-v1-2-b9fd3e448411@ideasonboard.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240103-si902x-fixes-v1-2-b9fd3e448411@ideasonboard.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e0f83c234e
commit
279f1cc562
@ -1040,7 +1040,9 @@ static int sii902x_init(struct sii902x *sii902x)
|
||||
return ret;
|
||||
}
|
||||
|
||||
sii902x_audio_codec_init(sii902x, dev);
|
||||
ret = sii902x_audio_codec_init(sii902x, dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
i2c_set_clientdata(sii902x->i2c, sii902x);
|
||||
|
||||
@ -1048,13 +1050,15 @@ static int sii902x_init(struct sii902x *sii902x)
|
||||
1, 0, I2C_MUX_GATE,
|
||||
sii902x_i2c_bypass_select,
|
||||
sii902x_i2c_bypass_deselect);
|
||||
if (!sii902x->i2cmux)
|
||||
return -ENOMEM;
|
||||
if (!sii902x->i2cmux) {
|
||||
ret = -ENOMEM;
|
||||
goto err_unreg_audio;
|
||||
}
|
||||
|
||||
sii902x->i2cmux->priv = sii902x;
|
||||
ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_unreg_audio;
|
||||
|
||||
sii902x->bridge.funcs = &sii902x_bridge_funcs;
|
||||
sii902x->bridge.of_node = dev->of_node;
|
||||
@ -1067,6 +1071,12 @@ static int sii902x_init(struct sii902x *sii902x)
|
||||
drm_bridge_add(&sii902x->bridge);
|
||||
|
||||
return 0;
|
||||
|
||||
err_unreg_audio:
|
||||
if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev))
|
||||
platform_device_unregister(sii902x->audio.pdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sii902x_probe(struct i2c_client *client,
|
||||
@ -1139,6 +1149,9 @@ static void sii902x_remove(struct i2c_client *client)
|
||||
|
||||
drm_bridge_remove(&sii902x->bridge);
|
||||
i2c_mux_del_adapters(sii902x->i2cmux);
|
||||
|
||||
if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev))
|
||||
platform_device_unregister(sii902x->audio.pdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id sii902x_dt_ids[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user