From: Albert Esteve Date: Fri, 8 May 2026 07:04:42 +0000 (+0200) Subject: drm/panel/samsung-s6e63m0: Use refcounted allocation in place of devm_kzalloc() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=feb0d6613a6f45eb38b910bc751963ae911170df;p=thirdparty%2Fkernel%2Flinux.git drm/panel/samsung-s6e63m0: 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. Reviewed-by: Neil Armstrong Reviewed-by: Maxime Ripard Signed-off-by: Albert Esteve Reviewed-by: Dmitry Baryshkov Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20260508-drm_panel_init_rm-v2-2-0bd4ac429971@redhat.com Signed-off-by: Maxime Ripard --- diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index ea241c89593b..997115b1e541 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -677,9 +677,13 @@ int s6e63m0_probe(struct device *dev, void *trsp, u32 max_brightness; int ret; - ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL); - if (!ctx) - return -ENOMEM; + ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel, + &s6e63m0_drm_funcs, + dsi_mode ? DRM_MODE_CONNECTOR_DSI : + DRM_MODE_CONNECTOR_DPI); + + if (IS_ERR(ctx)) + return PTR_ERR(ctx); ctx->transport_data = trsp; ctx->dsi_mode = dsi_mode; @@ -712,10 +716,6 @@ int s6e63m0_probe(struct device *dev, void *trsp, return PTR_ERR(ctx->reset_gpio); } - drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs, - dsi_mode ? DRM_MODE_CONNECTOR_DSI : - DRM_MODE_CONNECTOR_DPI); - ret = s6e63m0_backlight_register(ctx, max_brightness); if (ret < 0) return ret;