Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp182563pxx; Wed, 28 Oct 2020 01:57:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxseF1zRUqnFNvtViIwEx1NbLiBKJj8V+BDL/MLvmu7eaVJovTSnbQdpX4W9gK3Gbfbipu X-Received: by 2002:a50:f0c4:: with SMTP id a4mr6383322edm.289.1603875428790; Wed, 28 Oct 2020 01:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875428; cv=none; d=google.com; s=arc-20160816; b=bDDrP1OeEXZEpLonHP+EfbDIoCUy2BlfFH7Gdv9YoP6s0Kj0L3yTWC2lZAiogRgrK5 z8lzzisCWMuyyqvFdQTQk3iTzEe6TyIlZ/2BEvO0yyEktpWs3FrJ123cCcgvFMdYubg/ CAb1jsNrt4lMtGdr7E7g4fA5K0cmeGz/PdXnsbsdeYAc1OeukV5F8utUMjRHG4gffQTy qqdNFR7t5TMbo3lOvFH9qyMVFJ5RwQ5GlrpF4WyMQHZ9WNqND5fpuWV/kpsMuok7XX/P kX2k6T9bys0wsVtIN/LlE3AcBlfBo7GQxeXIxvTnyOjt7bGyyj83ntYOVrHD45wRV8FX d7+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z4sDn5+oSnqO0K/Yr4uWNro4uH5FQNL2V1IiXjZA75c=; b=RC8g8xcBU5yiUT2Fv1y53ShUsLnWaqYTY4Uxcs4ZAehMBB6eFid685KBgDD7OttVif Lnu4Lg+8I0ZdBWKV03Y+GI/gr/9U4nC2iDdZWBFGFynRIwciBZIamtuhLJsE6BOKeoy0 5bs17PaypdJLNIoR4PnAwRrQI/oeCEXK/EsNkxoM1iQ/HHf1vMVZ7G3YJzJxb2XnI15Y iSmwexBNi0Ti16gt2VxPhMXJBgsDcQPhOGfrCjNGqiGJWNb1geGZZtl9yazRmWkhkeV4 unpqEaxwlvZSd70Dhhgz/dC77vcCsFHbRdCImXCdRJvidOzE2PjujlBxQefBUKo4FszH YplQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iWZxPWdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si2524555edb.466.2020.10.28.01.56.47; Wed, 28 Oct 2020 01:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iWZxPWdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756562AbgJ0OOL (ORCPT + 99 others); Tue, 27 Oct 2020 10:14:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:59290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755511AbgJ0OKT (ORCPT ); Tue, 27 Oct 2020 10:10:19 -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 563B422202; Tue, 27 Oct 2020 14:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807818; bh=+t7VzI//Ab+P9NotX/kAxt0DjqRR8dYzVBJ44BisT24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWZxPWdyu0RlgP8JNC9Oi5mgRH9hZ7p4Roc7r1vSHhUDb09UJX+GG3ZxKjIWoBued Xe15WifW/CA6KPvW8beNwNerjIGQBZIIAxbbSZq0FUzmubkj8FkanaEwXyl6vYUpi+ nJ6JPxbYtAzxlu032aqltpvh+nJ5KJOICqOhihfU= 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 4.14 035/191] media: mx2_emmaprp: Fix memleak in emmaprp_probe Date: Tue, 27 Oct 2020 14:48:10 +0100 Message-Id: <20201027134911.430768337@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 951f2fd415b0d..163e825bf1aac 100644 --- a/drivers/media/platform/mx2_emmaprp.c +++ b/drivers/media/platform/mx2_emmaprp.c @@ -942,8 +942,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) -- 2.25.1