]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
drm/msm/dsi: Fix some reference counted resource leaks
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 6 Aug 2021 09:15:13 +0000 (11:15 +0200)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 11 Oct 2021 23:08:48 +0000 (17:08 -0600)
commitc4b7f4d2d4f38c8718d16fbb5b43ade57f60b2e1
tree9bab2b216124e7ad3ce8832d96e5de9e75bb4412
parentd1d6dba28d2fbcbe366f65167df6616afa5673e6
drm/msm/dsi: Fix some reference counted resource leaks

BugLink: https://bugs.launchpad.net/bugs/1946024
[ Upstream commit 6977cc89c87506ff17e6c05f0e37f46752256e82 ]

'of_find_device_by_node()' takes a reference that must be released when
not needed anymore.
This is expected to be done in 'dsi_destroy()'.

However, there are 2 issues in 'dsi_get_phy()'.

First, if 'of_find_device_by_node()' succeeds but 'platform_get_drvdata()'
returns NULL, 'msm_dsi->phy_dev' will still be NULL, and the reference
won't be released in 'dsi_destroy()'.

Secondly, as 'of_find_device_by_node()' already takes a reference, there is
no need for an additional 'get_device()'.

Move the assignment to 'msm_dsi->phy_dev' a few lines above and remove the
unneeded 'get_device()' to solve both issues.

Fixes: ec31abf6684e ("drm/msm/dsi: Separate PHY to another platform device")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f15bc57648a00e7c99f943903468a04639d50596.1628241097.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/gpu/drm/msm/dsi/dsi.c