drm/loongson: Fix error handling in lsdc_pixel_pll_setup()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Thu, 20 Jul 2023 12:39:50 +0000 (05:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:08 +0000 (11:59 +0100)
commit40a4db81900d58050e42d354db4e2e0026714fd0
tree3c21e0d7ab3e5c4fcee0dfcee5e61ffb0f949c0c
parent2f56a02e2ab0118b553dfc53b05eb65ce760975c
drm/loongson: Fix error handling in lsdc_pixel_pll_setup()

[ Upstream commit 5976a28b344ecb6810882a01b76a320cac21d307 ]

There are two problems in lsdc_pixel_pll_setup()
1. If kzalloc() fails then call iounmap() to release the resources.
2. Both kzalloc and ioremap does not return error pointers on failure, so
   using IS_ERR_OR_NULL() checks is a bit confusing and not very right,
   fix this by changing those to NULL checks instead.

Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Link: https://patchwork.freedesktop.org/patch/msgid/20230720123950.543082-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/loongson/lsdc_pixpll.c