From patchwork Sun Apr 26 20:06:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 11510987 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31C62912 for ; Sun, 26 Apr 2020 20:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A6702075B for ; Sun, 26 Apr 2020 20:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726234AbgDZUGp (ORCPT ); Sun, 26 Apr 2020 16:06:45 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:31102 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726188AbgDZUGp (ORCPT ); Sun, 26 Apr 2020 16:06:45 -0400 Received: from localhost.localdomain ([93.23.12.11]) by mwinf5d64 with ME id XY6a220010EJ3pp03Y6a9z; Sun, 26 Apr 2020 22:06:40 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 26 Apr 2020 22:06:40 +0200 X-ME-IP: 93.23.12.11 From: Christophe JAILLET To: kyungmin.park@samsung.com, kamil@wypas.org, a.hajda@samsung.com, mchehab@kernel.org, s.nawrocki@samsung.com, sachin.kamat@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] media: s5p-g2d: Fix a memory leak in an error handling path in 'g2d_probe()' Date: Sun, 26 Apr 2020 22:06:31 +0200 Message-Id: <20200426200631.42497-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Memory allocated with 'v4l2_m2m_init()' must be freed by a corresponding call to 'v4l2_m2m_release()' Fixes: 5ce60d790a24 ("[media] s5p-g2d: Add DT based discovery support") Signed-off-by: Christophe JAILLET --- drivers/media/platform/s5p-g2d/g2d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 6932fd47071b..ded6fa24677c 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c @@ -717,12 +717,14 @@ static int g2d_probe(struct platform_device *pdev) of_id = of_match_node(exynos_g2d_match, pdev->dev.of_node); if (!of_id) { ret = -ENODEV; - goto unreg_video_dev; + goto free_m2m; } dev->variant = (struct g2d_variant *)of_id->data; return 0; +free_m2m: + v4l2_m2m_release(dev->m2m_dev); unreg_video_dev: video_unregister_device(dev->vfd); rel_vdev: