]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/panel/lpm102a188a: Use refcounted allocation in place of devm_kzalloc()
authorAnusha Srivatsa <asrivats@redhat.com>
Fri, 11 Jul 2025 04:31:21 +0000 (23:31 -0500)
committerMaxime Ripard <mripard@kernel.org>
Wed, 16 Jul 2025 14:58:13 +0000 (16:58 +0200)
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-10-de73ba81b2f5@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c

index 5b5082efb282bcf705cf2d38dea24901e9803648..5f897e143758c2be51c39a20eeda2ecd09e1fbee 100644 (file)
@@ -435,9 +435,6 @@ static int jdi_panel_add(struct jdi_panel *jdi)
                return dev_err_probe(dev, PTR_ERR(jdi->backlight),
                                     "failed to create backlight\n");
 
-       drm_panel_init(&jdi->base, &jdi->link1->dev, &jdi_panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
-
        drm_panel_add(&jdi->base);
 
        return 0;
@@ -475,10 +472,13 @@ static int jdi_panel_dsi_probe(struct mipi_dsi_device *dsi)
 
        /* register a panel for only the DSI-LINK1 interface */
        if (secondary) {
-               jdi = devm_kzalloc(&dsi->dev, sizeof(*jdi), GFP_KERNEL);
-               if (!jdi) {
+               jdi = devm_drm_panel_alloc(&dsi->dev, __typeof(*jdi),
+                                          base, &jdi_panel_funcs,
+                                          DRM_MODE_CONNECTOR_DSI);
+
+               if (IS_ERR(jdi)) {
                        put_device(&secondary->dev);
-                       return -ENOMEM;
+                       return PTR_ERR(jdi);
                }
 
                mipi_dsi_set_drvdata(dsi, jdi);