[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200309101410.GA18031@duo.ucw.cz>
Date: Mon, 9 Mar 2020 11:14:10 +0100
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Pavel Machek <pavel@...x.de>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org, Stephen Boyd <swboyd@...omium.org>,
Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Rob Clark <robdclark@...il.com>,
Sean Paul <seanpaul@...omium.org>,
Douglas Anderson <dianders@...omium.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH] drm/msm: fix leaks if initialization fails
We should free resources in unlikely case of allocation failure.
Signed-off-by: Pavel Machek <pavel@...x.de>
---
> Can you submit a patch to fix it?
Here it is.
Best regards,
Pavel
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 83a0000eecb3..f5c1495cc4b9 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -444,8 +444,10 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
GFP_KERNEL);
- if (!dev->dma_parms)
- return -ENOMEM;
+ if (!dev->dma_parms) {
+ ret = -ENOMEM;
+ goto err_msm_uninit;
+ }
}
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists