Skip to content

Commit daeca2b

Browse files
anushasrivatsmripard
authored andcommitted
drm/panel/lg-sw43408: Use refcounted allocation in place of devm_kzalloc()
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 <[email protected]> Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-6-de73ba81b2f5@redhat.com Signed-off-by: Maxime Ripard <[email protected]>
1 parent a8f268a commit daeca2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/gpu/drm/panel/panel-lg-sw43408.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ static int sw43408_add(struct sw43408_panel *ctx)
246246

247247
ctx->base.prepare_prev_first = true;
248248

249-
drm_panel_init(&ctx->base, dev, &sw43408_funcs, DRM_MODE_CONNECTOR_DSI);
250-
251249
drm_panel_add(&ctx->base);
252250
return ret;
253251
}
@@ -257,9 +255,11 @@ static int sw43408_probe(struct mipi_dsi_device *dsi)
257255
struct sw43408_panel *ctx;
258256
int ret;
259257

260-
ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL);
261-
if (!ctx)
262-
return -ENOMEM;
258+
ctx = devm_drm_panel_alloc(&dsi->dev, __typeof(*ctx), base,
259+
&sw43408_funcs, DRM_MODE_CONNECTOR_DSI);
260+
261+
if (IS_ERR(ctx))
262+
return PTR_ERR(ctx);
263263

264264
dsi->mode_flags = MIPI_DSI_MODE_LPM;
265265
dsi->format = MIPI_DSI_FMT_RGB888;

0 commit comments

Comments
 (0)