drm/msm: fix leaks if initialization fails

We should free resources in unlikely case of allocation failure.

Signed-off-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
Pavel Machek 2020-03-09 11:14:10 +01:00 committed by Rob Clark
parent c479017faa
commit 66be340f82

View File

@ -444,8 +444,10 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
if (!dev->dma_parms) { if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
GFP_KERNEL); GFP_KERNEL);
if (!dev->dma_parms) if (!dev->dma_parms) {
return -ENOMEM; ret = -ENOMEM;
goto err_msm_uninit;
}
} }
dma_set_max_seg_size(dev, DMA_BIT_MASK(32)); dma_set_max_seg_size(dev, DMA_BIT_MASK(32));