]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
panel/lg-lg4573: Use refcounted allocation in place of devm_kzalloc()
authorAnusha Srivatsa <asrivats@redhat.com>
Wed, 21 May 2025 03:03:48 +0000 (22:03 -0500)
committerMaxime Ripard <mripard@kernel.org>
Wed, 21 May 2025 06:41:04 +0000 (08:41 +0200)
Move to using the new API devm_drm_panel_alloc() to allocate the
panel.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250520-drivers-mass-convert-part2-v3-17-f7ae7b723c68@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-lg-lg4573.c

index cf246d15b7b628a0b3821bfb2697842b6e484319..dec619902c15f8fbfdd138ef3bd2aa7cae921375 100644 (file)
@@ -243,9 +243,11 @@ static int lg4573_probe(struct spi_device *spi)
        struct lg4573 *ctx;
        int ret;
 
-       ctx = devm_kzalloc(&spi->dev, sizeof(*ctx), GFP_KERNEL);
-       if (!ctx)
-               return -ENOMEM;
+       ctx = devm_drm_panel_alloc(&spi->dev, struct lg4573, panel,
+                                  &lg4573_drm_funcs,
+                                  DRM_MODE_CONNECTOR_DPI);
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        ctx->spi = spi;
 
@@ -258,9 +260,6 @@ static int lg4573_probe(struct spi_device *spi)
                return ret;
        }
 
-       drm_panel_init(&ctx->panel, &spi->dev, &lg4573_drm_funcs,
-                      DRM_MODE_CONNECTOR_DPI);
-
        drm_panel_add(&ctx->panel);
 
        return 0;