From patchwork Tue Oct 27 13:50:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290011 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=ham 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 C2F4DC388F9 for ; Tue, 27 Oct 2020 14:33:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65EEC22264 for ; Tue, 27 Oct 2020 14:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809222; bh=6M+fV2azjk6ZCueVUTsz98HzYVcl55bUqhdL8/pzaQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=inCXf7S/fBoW4acBm3oP6DotKkaRl2L4vNAt6euMsL38DDmvW2BKI2Re1axvTqM7e nc538rHR1j1upYFLdCjU8MMQDGoZInVOhWKY8s6+urtVD79yoTNGW6OODcPdqAMZ+O q1PzYKdR5pG1m57+chkWMvluEWLHjmrSYQpG8X9s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760161AbgJ0Odk (ORCPT ); Tue, 27 Oct 2020 10:33:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:60642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760158AbgJ0Odk (ORCPT ); Tue, 27 Oct 2020 10:33:40 -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 EFB2B207BB; Tue, 27 Oct 2020 14:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809219; bh=6M+fV2azjk6ZCueVUTsz98HzYVcl55bUqhdL8/pzaQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpBoHZpeg7oLK1XGE/C9q+fiShR4+w8bpy07Rq852apdetxce2aCTESx+vn6bMg7g 79yRTTcou9oWCci8qWc7DxR0sMGjy87dXDylra0eqUM6MJrK4Cr/8GqMgHoxr9QVIC k3QQ1USiqxFdKxv9bEvCrTARgqC9IKMOtxy0o80o= 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.4 088/408] media: mx2_emmaprp: Fix memleak in emmaprp_probe Date: Tue, 27 Oct 2020 14:50:26 +0100 Message-Id: <20201027135459.159685305@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 27779b75df543..ac112cf06ab31 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)