From patchwork Tue Oct 27 13:46:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4E96C83030 for ; Tue, 27 Oct 2020 15:43:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9D6622400 for ; Tue, 27 Oct 2020 15:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813429; bh=VHdgOiu0cFIaKnbNnwJm16vfEUKRWoUX+lJJ1TXbTuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LYuvo4PZDls7GgYAR01tyl5B5PxaDyoQiyTke15WIJIuAZYJ/5YJ1b9G6i/BU0dx1 SxrudU5r1fx2RCDpsq1zqjnMGqhekA1sNGfllb9gbCKxE4ka6WMnXVqlHGgid64/1b YHQ/pmvlJu4awlN4sc2EzMc0CG5SPWxguGX+G4uI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S368644AbgJ0P05 (ORCPT ); Tue, 27 Oct 2020 11:26:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:40338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1797734AbgJ0PZD (ORCPT ); Tue, 27 Oct 2020 11:25:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E85BA2064B; Tue, 27 Oct 2020 15:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812302; bh=VHdgOiu0cFIaKnbNnwJm16vfEUKRWoUX+lJJ1TXbTuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fOYH2FtwCtW0c+3uVSw8p3y0eWzZnVh6UpmjwxEHtkQeEFc0xZW3v4ptoD2zIouxt n9VLh+T7TfqoEuAcrk2Vfxa2RPldT+YvgM24My7GYx4B2u0MV+zfd2+CTDEsF+tbE/ KwXXqQWR+GXaicxPQo04cGdBx8QlUmctsZff7b0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Fabio Estevam , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.9 161/757] media: mx2_emmaprp: Fix memleak in emmaprp_probe Date: Tue, 27 Oct 2020 14:46:51 +0100 Message-Id: <20201027135458.145272744@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit 21d387b8d372f859d9e87fdcc7c3b4a432737f4d ] When platform_get_irq() fails, we should release vfd and unregister pcdev->v4l2_dev just like the subsequent error paths. Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error") Signed-off-by: Dinghao Liu Reviewed-by: Fabio Estevam Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mx2_emmaprp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c index df78df59da456..08a5473b56104 100644 --- a/drivers/media/platform/mx2_emmaprp.c +++ b/drivers/media/platform/mx2_emmaprp.c @@ -852,8 +852,11 @@ static int emmaprp_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcdev); irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto rel_vdev; + } + ret = devm_request_irq(&pdev->dev, irq, emmaprp_irq, 0, dev_name(&pdev->dev), pcdev); if (ret)