This is a note to let you know that I've just added the patch titled drm/loongson: Fix error handling in lsdc_pixel_pll_setup() to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-loongson-fix-error-handling-in-lsdc_pixel_pll_se.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 70e30e1c13574c385ae250eaefac7b7b1f89f088 Author: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> Date: Thu Jul 20 05:39:50 2023 -0700 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@xxxxxxxxxx> Reviewed-by: Sui Jingfeng <suijingfeng@xxxxxxxxxxx> Signed-off-by: Sui Jingfeng <sui.jingfeng@xxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20230720123950.543082-1-harshit.m.mogalapalli@xxxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/gpu/drm/loongson/lsdc_pixpll.c b/drivers/gpu/drm/loongson/lsdc_pixpll.c index 04c15b4697e21..2609a2256da4b 100644 --- a/drivers/gpu/drm/loongson/lsdc_pixpll.c +++ b/drivers/gpu/drm/loongson/lsdc_pixpll.c @@ -120,12 +120,14 @@ static int lsdc_pixel_pll_setup(struct lsdc_pixpll * const this) struct lsdc_pixpll_parms *pparms; this->mmio = ioremap(this->reg_base, this->reg_size); - if (IS_ERR_OR_NULL(this->mmio)) + if (!this->mmio) return -ENOMEM; pparms = kzalloc(sizeof(*pparms), GFP_KERNEL); - if (IS_ERR_OR_NULL(pparms)) + if (!pparms) { + iounmap(this->mmio); return -ENOMEM; + } pparms->ref_clock = LSDC_PLL_REF_CLK_KHZ;