From: Albert Esteve Date: Fri, 8 May 2026 07:04:45 +0000 (+0200) Subject: drm/panel/ilitek-ili9806e: Use refcounted allocation in place of devm_kzalloc() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=98c38ff51e5b11fe08e4c95f3094f3beadb517df;p=thirdparty%2Flinux.git drm/panel/ilitek-ili9806e: 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-5-0bd4ac429971@redhat.com Signed-off-by: Maxime Ripard --- diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c index be2cf14401553..53e25d1086db8 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c @@ -78,9 +78,11 @@ int ili9806e_probe(struct device *dev, void *transport, bool set_prepare_prev_first = false; int ret; - ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL); - if (!ctx) - return -ENOMEM; + ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel, + funcs, connector_type); + + if (IS_ERR(ctx)) + return PTR_ERR(ctx); dev_set_drvdata(dev, ctx); ctx->transport = transport; @@ -103,8 +105,6 @@ int ili9806e_probe(struct device *dev, void *transport, return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to get reset-gpios\n"); - drm_panel_init(&ctx->panel, dev, funcs, connector_type); - ret = drm_panel_of_backlight(&ctx->panel); if (ret) return dev_err_probe(dev, ret, "Failed to get backlight\n");