From: Daniel Vetter Date: Mon, 23 Mar 2020 14:49:14 +0000 (+0100) Subject: drm/repaper: Use drmm_add_final_kfree X-Git-Tag: v5.15~303^2~28^2~3149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=144a29fdac4ede527008646488cd7c32d6289de7;p=platform%2Fkernel%2Flinux-starfive.git drm/repaper: Use drmm_add_final_kfree With this we can drop the final kfree from the release function. Acked-by: Sam Ravnborg Reviewed-by: Noralf Trønnes Signed-off-by: Daniel Vetter Cc: "Noralf Trønnes" Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-16-daniel.vetter@ffwll.ch --- diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c index f5ebcaf..df5654e 100644 --- a/drivers/gpu/drm/tiny/repaper.c +++ b/drivers/gpu/drm/tiny/repaper.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -910,13 +911,10 @@ static const struct drm_mode_config_funcs repaper_mode_config_funcs = { static void repaper_release(struct drm_device *drm) { - struct repaper_epd *epd = drm_to_epd(drm); - DRM_DEBUG_DRIVER("\n"); drm_mode_config_cleanup(drm); drm_dev_fini(drm); - kfree(epd); } static const uint32_t repaper_formats[] = { @@ -1024,6 +1022,7 @@ static int repaper_probe(struct spi_device *spi) kfree(epd); return ret; } + drmm_add_final_kfree(drm, epd); drm_mode_config_init(drm); drm->mode_config.funcs = &repaper_mode_config_funcs;