From: Albert Esteve Date: Fri, 8 May 2026 07:04:47 +0000 (+0200) Subject: drm/panel/sharp-ls043t1le01: Use refcounted allocation in place of devm_kzalloc() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c02427a772e93d5005fd0766d7a2ee6b7b17447d;p=thirdparty%2Fkernel%2Flinux.git drm/panel/sharp-ls043t1le01: 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-7-0bd4ac429971@redhat.com Signed-off-by: Maxime Ripard --- diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c index dd1eaba23ad3..989b030ea22d 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -199,8 +199,6 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt) gpiod_set_value(sharp_nt->reset_gpio, 0); } - drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev, - &sharp_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI); sharp_nt->base.prepare_prev_first = true; ret = drm_panel_of_backlight(&sharp_nt->base); @@ -231,9 +229,12 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi) MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_NO_EOT_PACKET; - sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL); - if (!sharp_nt) - return -ENOMEM; + sharp_nt = devm_drm_panel_alloc(&dsi->dev, __typeof(*sharp_nt), base, + &sharp_nt_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + + if (IS_ERR(sharp_nt)) + return PTR_ERR(sharp_nt); mipi_dsi_set_drvdata(dsi, sharp_nt);