Re: [PATCH] drm: bridge: adv7511: Add check for mipi_dsi_driver_register
From: Laurent Pinchart
Date: Wed Jun 01 2022 - 02:52:14 EST
Hi Jiasheng,
Thank you for the patch.
On Wed, Jun 01, 2022 at 10:48:22AM +0800, Jiasheng Jiang wrote:
> As mipi_dsi_driver_register could return error if fails,
> it should be better to check the return value and return error
> if fails.
>
> Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device")
> Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index 5bb9300040dd..795855b41eb2 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -1392,8 +1392,13 @@ static struct i2c_driver adv7511_driver = {
>
> static int __init adv7511_init(void)
> {
> - if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
> - mipi_dsi_driver_register(&adv7533_dsi_driver);
> + int ret;
> +
> + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
> + ret = mipi_dsi_driver_register(&adv7533_dsi_driver);
> + if (ret)
> + return ret;
> + }
>
> return i2c_add_driver(&adv7511_driver);
While at it, should this then call mipi_dsi_driver_unregister() on
failure ?
> }
> --
> 2.25.1
>
--
Regards,
Laurent Pinchart