]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
panel/widechips-ws2401: Use refcounted allocation in place of devm_kzalloc()
authorAnusha Srivatsa <asrivats@redhat.com>
Fri, 30 May 2025 02:46:43 +0000 (21:46 -0500)
committerMaxime Ripard <mripard@kernel.org>
Mon, 2 Jun 2025 07:22:07 +0000 (09:22 +0200)
Move to using the new API devm_drm_panel_alloc() to allocate the
panel.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250529-b4-drm_panel_mass_driver_convert_part3-v2-41-5d75a3711e40@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-widechips-ws2401.c

index 2591ff8f0d4e8b84b7283718bf05684e8d44d1f5..dd74610bd2eb870bbdb74bfce7a1b88ee5d1abc6 100644 (file)
@@ -347,9 +347,11 @@ static int ws2401_probe(struct spi_device *spi)
        struct ws2401 *ws;
        int ret;
 
-       ws = devm_kzalloc(dev, sizeof(*ws), GFP_KERNEL);
-       if (!ws)
-               return -ENOMEM;
+       ws = devm_drm_panel_alloc(dev, struct ws2401, panel, &ws2401_drm_funcs,
+                                 DRM_MODE_CONNECTOR_DPI);
+       if (IS_ERR(ws))
+               return PTR_ERR(ws);
+
        ws->dev = dev;
 
        /*
@@ -379,9 +381,6 @@ static int ws2401_probe(struct spi_device *spi)
        ws2401_read_mtp_id(ws);
        ws2401_power_off(ws);
 
-       drm_panel_init(&ws->panel, dev, &ws2401_drm_funcs,
-                      DRM_MODE_CONNECTOR_DPI);
-
        ret = drm_panel_of_backlight(&ws->panel);
        if (ret)
                return dev_err_probe(dev, ret,