drm: rcar-du: Use DRM-managed allocation for encoders
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 3 Dec 2020 13:09:22 +0000 (15:09 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 5 Jan 2021 05:20:02 +0000 (07:20 +0200)
commitf5f16725edbc1a53d4ef5c23c83a43f89ad1466f
tree7174e5f8d7eb1de55116b964c76a8bc4305382dd
parent73deb7b34c845a04047ad9ecd945f82e31614a40
drm: rcar-du: Use DRM-managed allocation for encoders

devm_kzalloc() is the wrong API to allocate encoders, as the lifetime of
the encoders is tied to the DRM device, not the device to driver
binding. drmm_kzalloc() isn't a good option either, as it would result
in the encoder being freed before being unregistered during the managed
cleanup of the DRM objects. Use a plain kzalloc(), and register a drmm
action to cleanup the encoder.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_encoder.c