From patchwork Fri Sep 29 10:51:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9977495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7FCF960329 for ; Fri, 29 Sep 2017 10:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 842B129783 for ; Fri, 29 Sep 2017 10:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7906A29810; Fri, 29 Sep 2017 10:51:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17AB229783 for ; Fri, 29 Sep 2017 10:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbdI2Kvh (ORCPT ); Fri, 29 Sep 2017 06:51:37 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:43910 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbdI2Kvh (ORCPT ); Fri, 29 Sep 2017 06:51:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=mCs8WJbwq0L94ZtWENScCwb1rfeWl+XEgY719vvYoCQ=; b=RfbQEbOACbFs+ZBI6qux4jnDbKkHuZ/eYTe0Twc1aaFYbivLBl9FEKT12rLzOmhn/lKLeXZvrtOPMGDRDPtmGqMi339QIiyk5yfVUXdGzditJ9F2D0F2ShySixIJX5MlC8TKmGgCwmefi/mHSZCm4cQkND0E3B4fYB7GxkUfE+E=; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36574 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1dxstL-0000Ye-Dc; Fri, 29 Sep 2017 11:51:35 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1dxstE-0006jU-BQ; Fri, 29 Sep 2017 11:51:28 +0100 In-Reply-To: <20170929105004.GY20805@n2100.armlinux.org.uk> References: <20170929105004.GY20805@n2100.armlinux.org.uk> From: Russell King To: Bartlomiej Zolnierkiewicz Cc: linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org Subject: [PATCH 7/8] video: sa1100fb: fix video memory allocation leak MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 29 Sep 2017 11:51:28 +0100 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't leak the video memory allocation if register_framebuffer() fails. Signed-off-by: Russell King --- drivers/video/fbdev/sa1100fb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 16a974471c02..56d514b5d252 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -1262,8 +1262,11 @@ static int sa1100fb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fbi); ret = register_framebuffer(&fbi->fb); - if (ret < 0) - goto failed; + if (ret < 0) { + dma_free_wc(fbi->dev, fbi->map_size, fbi->map_cpu, + fbi->map_dma); + return ret; + } #ifdef CONFIG_CPU_FREQ fbi->freq_transition.notifier_call = sa1100fb_freq_transition; @@ -1274,9 +1277,6 @@ static int sa1100fb_probe(struct platform_device *pdev) /* This driver cannot be unloaded at the moment */ return 0; - - failed: - return ret; } static struct platform_driver sa1100fb_driver = {