Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1928874ybv; Fri, 14 Feb 2020 08:23:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz1ELuuV/2j1yoULX1M2UggsHqC+YO5bmc8fubbJ2IB9iQ/VaXVISp0dxOoqy8WtF4Yk1ve X-Received: by 2002:aca:5dc3:: with SMTP id r186mr2448282oib.137.1581697417045; Fri, 14 Feb 2020 08:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697417; cv=none; d=google.com; s=arc-20160816; b=M4T1fL5J8JLzAwWlSXggN6HGTDc5cruFcX4EEyKiLLFADMKtCWYsVGi6GQPxiGcEcR TaClLFIuqpPd33DMBEDoZHtAHQtSw11XDoVPrBOfyfgvP2yIHY4gyJkLWGmysQazd5/I a/paDdVx/k2WiHX7MCDZMHUW06ASEB/c2IzWckJpET9YVYVFTTL02t5Jg7vQIHh5Et82 R4IkA361O5W0Yl2nTfQRb3n29LrrXxUSY/xFzFyOOTNM5hwutXuEVNjoAq1hF0monhEk WtnsMzCiwfZyHwj1MAIUgvGsQN/ebtf00tDkSmHqzgaYRpTMqBWgrmssmunaDXJYzEHP g1LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GrNIcW3ms4mc6wpuYEW6T0J/t7abgWeirLxM626oWQQ=; b=CDN3aiRpzgHb04J5VvwAeo8n2A5uykC6s8soyCHRmICoIh8jW+vYL/aYTKw48eGYuJ HlG2PLD5ey0Ovd+XZH1vNCpUhUwEDIT4sSmCOw1StXzShacAgX29E3Lgn/XYR98t3/xV x0EslE7EdgjWv4+C33SAMsFB4PB9ESb2CPBKQHRUMTWHvpW8oP+WL0ZYFHTK86SPeeFX OP6Qi/O9XBfiw+raWDW10VCLGYN4MgLv5XXYTgQBiUunfJDyot5Y/AVP5UrenZiOLRKx dcGEzYLzHSAsXupfJZyNeAmmxr8hZ61egBP8zbukzosDgddTAHIyVsJ3zLfgHjL+sraE kd8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G4DLG1CD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id i124si3088277oif.214.2020.02.14.08.23.25; Fri, 14 Feb 2020 08:23:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G4DLG1CD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2405542AbgBNQWq (ORCPT + 99 others); Fri, 14 Feb 2020 11:22:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:56264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392329AbgBNQVf (ORCPT ); Fri, 14 Feb 2020 11:21:35 -0500 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 86DD1246A6; Fri, 14 Feb 2020 16:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697294; bh=8Tg0HQeU8QFKYHVtVIxc5GOOIl8RtN1hrGNhC1kUx4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4DLG1CDY+9TdFXBnrZzrXOkhPMS1yoCV6rrrQlCXPIyqefTfxV2hamEKPohVFdCo scFjcl1+hqeo7xtAAIW2KHyouzAAntZ3R5Bb/fWbkvOLGy2kKiItACqNzDsvB0dgWf N41bd6gsELC9Hx3pRCj+y0UPZK1n997o3hpAMK68= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Lubomir Rintel , YueHaibing , Bartlomiej Zolnierkiewicz , Sasha Levin , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 009/141] pxa168fb: Fix the function used to release some memory in an error handling path Date: Fri, 14 Feb 2020 11:19:09 -0500 Message-Id: <20200214162122.19794-9-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 3c911fe799d1c338d94b78e7182ad452c37af897 ] In the probe function, some resources are allocated using 'dma_alloc_wc()', they should be released with 'dma_free_wc()', not 'dma_free_coherent()'. We already use 'dma_free_wc()' in the remove function, but not in the error handling path of the probe function. Also, remove a useless 'PAGE_ALIGN()'. 'info->fix.smem_len' is already PAGE_ALIGNed. Fixes: 638772c7553f ("fb: add support of LCD display controller on pxa168/910 (base layer)") Signed-off-by: Christophe JAILLET Reviewed-by: Lubomir Rintel CC: YueHaibing Signed-off-by: Bartlomiej Zolnierkiewicz Link: https://patchwork.freedesktop.org/patch/msgid/20190831100024.3248-1-christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/video/fbdev/pxa168fb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c index d059d04c63acd..20195d3dbf088 100644 --- a/drivers/video/fbdev/pxa168fb.c +++ b/drivers/video/fbdev/pxa168fb.c @@ -769,8 +769,8 @@ static int pxa168fb_probe(struct platform_device *pdev) failed_free_clk: clk_disable_unprepare(fbi->clk); failed_free_fbmem: - dma_free_coherent(fbi->dev, info->fix.smem_len, - info->screen_base, fbi->fb_start_dma); + dma_free_wc(fbi->dev, info->fix.smem_len, + info->screen_base, fbi->fb_start_dma); failed_free_info: kfree(info); @@ -804,7 +804,7 @@ static int pxa168fb_remove(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); - dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len), + dma_free_wc(fbi->dev, info->fix.smem_len, info->screen_base, info->fix.smem_start); clk_disable_unprepare(fbi->clk); -- 2.20.1