Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-6-de73ba81b2f5@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>

authored by

Anusha Srivatsa and committed by
Maxime Ripard
daeca2b7 a8f268ac

+5 -5
+5 -5
drivers/gpu/drm/panel/panel-lg-sw43408.c
··· 246 246 247 247 ctx->base.prepare_prev_first = true; 248 248 249 - drm_panel_init(&ctx->base, dev, &sw43408_funcs, DRM_MODE_CONNECTOR_DSI); 250 - 251 249 drm_panel_add(&ctx->base); 252 250 return ret; 253 251 } ··· 255 257 struct sw43408_panel *ctx; 256 258 int ret; 257 259 258 - ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); 259 - if (!ctx) 260 - return -ENOMEM; 260 + ctx = devm_drm_panel_alloc(&dsi->dev, __typeof(*ctx), base, 261 + &sw43408_funcs, DRM_MODE_CONNECTOR_DSI); 262 + 263 + if (IS_ERR(ctx)) 264 + return PTR_ERR(ctx); 261 265 262 266 dsi->mode_flags = MIPI_DSI_MODE_LPM; 263 267 dsi->format = MIPI_DSI_FMT_RGB888;