Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3515297pxa; Wed, 26 Aug 2020 02:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvRHd2suow8TWKGGmqihHBAooSbCh2xJkcCtEoYkZZFqv5pjkSrmjbxsPNqw+twpAG4Ybs X-Received: by 2002:aa7:c143:: with SMTP id r3mr13644891edp.38.1598434107738; Wed, 26 Aug 2020 02:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598434107; cv=none; d=google.com; s=arc-20160816; b=SXwRq5HVjMumG7UpUQbCDcX3mxMsB8NQu1+ExEaTvmxEupHVbhNz6vfvoBuS2hfT+d dAUXma6Rsae+6BZ/58kbTSZBfP0oWdf3V5sHIhfCiFQYE5hIx45lw+CuwljQSJE6x90d c+l+YPKa7IXUsizUJYGtSoWbbClm+FtUWoSSaQeNa6EncKrRGqbsHcLak/kRmXwxKcvG Ykl3jYOp+PG5kmnMHK6+JfDhjW90kY2WqC2mCfnmfAKMpgba4MBfJlXcuk/KUxHOM3io 2TRtLC6VJaT/Ip3jfGDIe8cZ7I0ytEoicZc7seV0bZpzo34TDFyNujamOlngv7bH4e8t dEJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=/lSeA0Vhse+G1Y+kY4omDw4d0DAKeUXxDV2xdxBBnsQ=; b=fkdVWuW6DpJsXLuN66bZZb4LxuT93Tb2ZpONxXAmxwam/KrM5X5QzYeplwyHff/jK+ CmDF3KSrbo22brgdip8iB0uRpZJxyTlzLDwit6XzAdSemwd2DNPC3bKi2AB0ZGeN8i2o AY2CVwWWcW8EFEVB3Cblab1l2lPleXx4YGrpxDoNpvLa0S7/OVkjGEOLHv13px7z3OZS iIrbW1nl8GDu+0BJVggYYk4o0Wx7uSaUtmLIwJ3o6+yivuolEsMFzMER9VxbO3sN1sUP tzqHed8xNE891wZqFVlstWplYDITIaCwkB9KgSB9kbr1AulpjKi0NcF5qnbKTMocrxYn yokA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si1221681ejh.517.2020.08.26.02.28.04; Wed, 26 Aug 2020 02:28:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728141AbgHZJ0w (ORCPT + 99 others); Wed, 26 Aug 2020 05:26:52 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:36686 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728068AbgHZJ0R (ORCPT ); Wed, 26 Aug 2020 05:26:17 -0400 Received: from localhost.localdomain (unknown [210.32.144.184]) by mail-app3 (Coremail) with SMTP id cC_KCgAXb_WuKkZfTOo9Aw--.41828S4; Wed, 26 Aug 2020 17:26:10 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Mauro Carvalho Chehab , Hans Verkuil , Fabio Estevam , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] media: mx2_emmaprp: Fix memleak in emmaprp_probe Date: Wed, 26 Aug 2020 17:26:04 +0800 Message-Id: <20200826092606.2910-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgAXb_WuKkZfTOo9Aw--.41828S4 X-Coremail-Antispam: 1UD129KBjvdXoW7XF1kGr4rZrWrGrW8CF1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linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changelog: v2: - Add 'ret = irq;'. --- 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 df78df59da45..08a5473b5610 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) -- 2.17.1