Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp879200pxk; Thu, 17 Sep 2020 20:08:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+TgLuW8fMRpUvRk8NAR5olTKV5mu4bnUm4neHPqP0ik7U7c6fjcjlc6nYBhpfv9cpYn/U X-Received: by 2002:a17:906:9591:: with SMTP id r17mr35183084ejx.424.1600398539493; Thu, 17 Sep 2020 20:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398539; cv=none; d=google.com; s=arc-20160816; b=YNWr/0kamZs05qp0pC7pJmVTItT6y/5naEUBLqJZfEWzAI3HW1FnbDb81/HBf7RTYk VkA0RJHIgGFE0Cx1zlLWs93hxbXr30BGZvk9hpZCcS2Wzvv3GOLfvaLSEl3iFdyPzkO8 WMGPg/1QTg7GW2Ib8hS74fz/fc6BNWld3StDJTxAL0uWIfY+7SnyUDnoSUqcIfPqr2cY s8xBr5lxG74dDszmWe83jatCqFHWiKeUdLbquAy82yjB+HV940qe9nApI8cf7f2LkQj1 5ArZPz0ShxDa0e3XtpgaF6YHg5OTEln4ZaYzXEmvqVX0fDYb8MWUmaa4zB2KDPBO77ml DleQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CUTNz211pRfUDAlfIW5gMJGuVYVZY/gNoMK7LcklhNg=; b=UEQGaKV0z3J3higeYJH+mHyIwZjWvguiosd16IJU/+4nbxroGNG+wxBYwOar3fdzL+ 0VqvedJlJzCucIUmHpxaYkBX0HpE/4V23tO+qYH0x3jHiNc04c+ukozTsh2xAn+K1qZq Q/S0SAi/Q/YoCyEIP4gsr7GbKOHKJv5E5oyqeJXeTID6+e0i09p86Z+GDEETe6/DOtCE 4lmzPpKlKlQ3KE0FOmDhcjptFd8nVq4s81Gy97gsTWfZeRIMNFC66lKcQEHjTfUYgYJs TW3z2R1kfANNdUPKn08/olDMuZDHiInyiIck1e1GmtqwcIuPRazne5j9PkKuswuFp5pJ XKig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gF1A2NCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1175044eja.287.2020.09.17.20.08.36; Thu, 17 Sep 2020 20:08:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gF1A2NCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730572AbgIRDEQ (ORCPT + 99 others); Thu, 17 Sep 2020 23:04:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:52640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbgIRCEx (ORCPT ); Thu, 17 Sep 2020 22:04:53 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFA7C2388B; Fri, 18 Sep 2020 02:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394693; bh=LoTtfgHtKtt1kt5u8RjyjW+2ok8FCys6Buytalzc7l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gF1A2NCwIsHSvJrB/uHiq4371tJtBYMTFeBH8Ong+HUvT0/OYXM1C3vwDNYvT4tKc Io+u6g+8+8zqutafzSvxsdRXrOz0lovbV88CAPUQTkaDYzmI2h0ZrgGxIlaoUWTumD o1VNublvJbmyP9Ia4orzhi6nTYuVD6xq1C8wCfiw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pavel Machek , Rob Clark , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 181/330] drm/msm: fix leaks if initialization fails Date: Thu, 17 Sep 2020 21:58:41 -0400 Message-Id: <20200918020110.2063155-181-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Machek [ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ] We should free resources in unlikely case of allocation failure. Signed-off-by: Pavel Machek Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 4558d66761b3c..108632a1f2438 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)); -- 2.25.1