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: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" 
Touchscreen.")
Signed-off-by: Jiasheng Jiang <jiash...@iscas.ac.cn>
---
 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c 
b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 145047e19394..cc90afbf4b3e 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -498,7 +498,12 @@ static struct i2c_driver rpi_touchscreen_driver = {
 
 static int __init rpi_touchscreen_init(void)
 {
-       mipi_dsi_driver_register(&rpi_touchscreen_dsi_driver);
+       int ret;
+
+       ret = mipi_dsi_driver_register(&rpi_touchscreen_dsi_driver);
+       if (ret)
+               return ret;
+
        return i2c_add_driver(&rpi_touchscreen_driver);
 }
 module_init(rpi_touchscreen_init);
-- 
2.25.1

Reply via email to