drm/hisilicon: Code refactoring for hibmc_drv_de
authorTian Tao <tiantao6@hisilicon.com>
Wed, 12 Aug 2020 07:42:59 +0000 (15:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:12:21 +0000 (10:12 +0100)
commitce8a7f51a662d03e91828a6fceefe1d659f83c50
treebf85a8f0a1792aefedeed676919b946379d0dcdf
parent5c4a56534d608071f477713a4f320e6d098eed20
drm/hisilicon: Code refactoring for hibmc_drv_de

[ Upstream commit 13b0d4a9ae0c2d650993c48be797992eaf621332 ]

The memory used to be allocated with devres helpers and released
automatically. In rare circumstances, the memory's release could
have happened before the DRM device got released, which would have
caused memory corruption of some kind. Now we're embedding the data
structures in struct hibmc_drm_private. The whole release problem
has been resolved, because struct hibmc_drm_private is allocated
with drmm_kzalloc and always released with the DRM device.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1597218179-3938-3-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h