Skip to content

Commit

Permalink
drm: rcar-du: Put reference to VSP device
Browse files Browse the repository at this point in the history
[ Upstream commit 2a32dbd ]

The reference to the VSP device acquired with of_find_device_by_node()
in rcar_du_vsp_init() is never released. Fix it with a drmm action,
which gets run both in the probe error path and in the remove path.

Fixes: 6d62ef3 ("drm: rcar-du: Expose the VSP1 compositor through KMS planes")
Reported-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Laurent Pinchart authored and gregkh committed Oct 29, 2020
1 parent 0e8f426 commit e43acbf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/gpu/drm/rcar-du/rcar_du_vsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_vblank.h>

Expand Down Expand Up @@ -341,6 +342,13 @@ static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
.atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state,
};

static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
{
struct rcar_du_vsp *vsp = res;

put_device(vsp->vsp);
}

int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
unsigned int crtcs)
{
Expand All @@ -357,6 +365,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,

vsp->vsp = &pdev->dev;

ret = drmm_add_action(rcdu->ddev, rcar_du_vsp_cleanup, vsp);
if (ret < 0)
return ret;

ret = vsp1_du_init(vsp->vsp);
if (ret < 0)
return ret;
Expand Down

0 comments on commit e43acbf

Please sign in to comment.