Commit 83146366 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Sam Ravnborg

drm: bridge: adv7511: Add check for mipi_dsi_driver_register

As mipi_dsi_driver_register could return error if fails,
it should be better to check the return value and return error
if fails.
Moreover, if i2c_add_driver fails,  mipi_dsi_driver_register
should be reverted.

Fixes: 1e4d58cd ("drm/bridge: adv7533: Create a MIPI DSI device")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220602103401.2980938-1-jiasheng@iscas.ac.cn
parent 25ba9429
......@@ -1393,10 +1393,21 @@ static struct i2c_driver adv7511_driver = {
static int __init adv7511_init(void)
{
int ret;
if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
ret = mipi_dsi_driver_register(&adv7533_dsi_driver);
if (ret)
return ret;
}
ret = i2c_add_driver(&adv7511_driver);
if (ret) {
if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
mipi_dsi_driver_register(&adv7533_dsi_driver);
mipi_dsi_driver_unregister(&adv7533_dsi_driver);
}
return i2c_add_driver(&adv7511_driver);
return ret;
}
module_init(adv7511_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment