]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel: himax-hx83121a: Fix incorrect error check for devm_drm_panel_alloc()
authorChen Ni <nichen@iscas.ac.cn>
Fri, 27 Mar 2026 02:17:28 +0000 (10:17 +0800)
committerNeil Armstrong <neil.armstrong@linaro.org>
Tue, 5 May 2026 12:43:36 +0000 (14:43 +0200)
Check devm_drm_panel_alloc() return value for ERR_PTR instead of NULL.
devm_drm_panel_alloc() returns an ERR_PTR on failure, never NULL. Using
a NULL check skips the error path and may cause a NULL pointer
dereference.

Fixes: a7c61963b727 ("drm/panel: Add Himax HX83121A panel driver")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Pengyu Luo <mitltlatltl@gmail.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260327021728.647182-1-nichen@iscas.ac.cn
drivers/gpu/drm/panel/panel-himax-hx83121a.c

index ebe643ba41844a55b4639242777cc773ea014831..bed79aa06f46a63cfcdfa7dd32e0ff8259a095af 100644 (file)
@@ -596,8 +596,8 @@ static int himax_probe(struct mipi_dsi_device *dsi)
 
        ctx = devm_drm_panel_alloc(dev, struct himax, panel, &himax_panel_funcs,
                                   DRM_MODE_CONNECTOR_DSI);
-       if (!ctx)
-               return -ENOMEM;
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        ret = devm_regulator_bulk_get_const(&dsi->dev,
                                            ARRAY_SIZE(himax_supplies),