From patchwork Tue Sep 12 05:39:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9948445 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 4FFFD60360 for ; Tue, 12 Sep 2017 05:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44B0928D8E for ; Tue, 12 Sep 2017 05:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3918428E47; Tue, 12 Sep 2017 05:42:46 +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.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 EEA2F28D8E for ; Tue, 12 Sep 2017 05:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751239AbdILFmc (ORCPT ); Tue, 12 Sep 2017 01:42:32 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:19555 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbdILFmb (ORCPT ); Tue, 12 Sep 2017 01:42:31 -0400 Received: from localhost.localdomain ([86.196.182.67]) by mwinf5d04 with ME id 8ViU1w0051TfVo603ViUXa; Tue, 12 Sep 2017 07:42:30 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 12 Sep 2017 07:42:30 +0200 X-ME-IP: 86.196.182.67 From: Christophe JAILLET To: b.zolnierkie@samsung.com, tj@kernel.org, viro@zeniv.linux.org.uk Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' Date: Tue, 12 Sep 2017 07:39:30 +0200 Message-Id: <20170912053930.18931-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 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 If 'dmam_alloc_attrs()' fails, we must go through the error handling code, as done elsewhere in this function. Otherwise, there is a resource leak. Signed-off-by: Christophe JAILLET --- I'm also puzzled by the 'framebuffer_alloc()' call a few lines above. 'ret' is known to be 0 at this point. I guess that -ENOMEM should also be returned. --- drivers/video/fbdev/au1200fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 5f04b4096c42..99d6cfb168b5 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1701,7 +1701,8 @@ static int au1200fb_drv_probe(struct platform_device *dev) if (!fbdev->fb_mem) { print_err("fail to allocate frambuffer (size: %dK))", fbdev->fb_len / 1024); - return -ENOMEM; + ret = -ENOMEM; + goto failed; } /*