Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp13739rdd; Wed, 22 Nov 2023 08:12:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9ycWgLlgKWF+yU1/aTd+IaIl0rbmMIsdY+Q53gdXr8jIJdzl8c2R6Bpa/+RZa+5Kkc4n2 X-Received: by 2002:a05:6a20:d418:b0:188:aea:2138 with SMTP id il24-20020a056a20d41800b001880aea2138mr2711762pzb.19.1700669576596; Wed, 22 Nov 2023 08:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700669576; cv=none; d=google.com; s=arc-20160816; b=VzeaeQy6JlTGqgLrpmRvQ5W1fjbMcpMnUT8Hd0svqX6S9UtcLw4ommiESTMUCElyz4 5Dkskgo9ew5fAoB2aq5MXt3OGftA4GCsI5eiFg4/7iFlXIOj5N7KwGG7FzMlxy/hToVI abiCPEFjoP1XRR9joHF+E6mBTyth/FRpPl/IXGqH/9Bgf5WDPU/32RFMm1Bjv/2q+RrD pcS+1a+YpAiTJcrRYk4gm5w/uTnJPMkL85skHmkuuV0l2EMLN6VElLVbCNhpRhdhT5D2 5wHBx/+HXlVD8XrL4tqIdluQ0u1RG/mxlpdU9cLj/6EmNTUI4lzUbS7UjnVG4O4ee076 I9yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=6EkRRgJgJWhdwnmeZdON29wK0doJyE3XDN+/KsxITRM=; fh=C0dXkAvu/VipV4SxI6kL8WioTQwoH+s7n35QCI5Zld8=; b=pFkHa1J7i8NWOOLqpSXqt3OSwzRsgc2FEt6ujhxUzhfX/dGMXeD4qnbX2x9FAfxc9d WOuufADn86QI3cX9L7+m+QP1itL6qhh25QUaipSm/CGntVY9I6x5DQU3F291sthv9DY8 HOg+rOzTKHQwmrTjiRyA7q+RYkUEe7SSw1HKVjT9PrCoTzzgoLpqGAweoRI7lNYjiq8i USjLRWr8sSnAJ6LQPm0xrKzG2zeOLgpOdwi2re7FlqFmWeOQUiceBdTEZY4VieCUvsvr wjBTIs4X8ilrzr0VgjQ2HtbBDuIfLWlrPcrOEMVx3pAOPy17ySH3VAi0ouCEn1RPF8ET aFdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aRXmXmYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w188-20020a6262c5000000b006cb8ea1f1besi7414104pfb.65.2023.11.22.08.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:12:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aRXmXmYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1BCF581DD252; Wed, 22 Nov 2023 08:12:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229634AbjKVQMk (ORCPT + 99 others); Wed, 22 Nov 2023 11:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232024AbjKVPuf (ORCPT ); Wed, 22 Nov 2023 10:50:35 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E793610F2; Wed, 22 Nov 2023 07:50:31 -0800 (PST) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9789B29A; Wed, 22 Nov 2023 16:49:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700668198; bh=u1nisTy6lw7HXt2aKNr+FUe0wDrA0s3HuQr4p3ZdaGM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aRXmXmYTEkWFcC1ogtFroAntPMVyK3vncwqShJhK0UOwVNtgmc60ohECc7/RfsO4R CrFManNjmqDjxTvLHdqDvnbT3zblBujpCD6FKX8kxDzFaPNUgPS/ydsnFYaIrk9T7C Xs9FkajPO0Buh4SdjgOvTcVs7oyCZG3y0tTqINt0= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 17:50:07 +0200 Subject: [PATCH v2 1/2] media: rkisp1: Fix media device memory leak MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231122-rkisp-fixes-v2-1-78bfb63cdcf8@ideasonboard.com> References: <20231122-rkisp-fixes-v2-0-78bfb63cdcf8@ideasonboard.com> In-Reply-To: <20231122-rkisp-fixes-v2-0-78bfb63cdcf8@ideasonboard.com> To: Dafna Hirschfeld , Laurent Pinchart , Mauro Carvalho Chehab , Heiko Stuebner , Jacob Chen , Yichong Zhong , Shunqian Zheng , Paul Elder , Sakari Ailus Cc: Kieran Bingham , Hans Verkuil , Eddie Cai , Allon Huang , Jeffy Chen , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Tommaso Merciai X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1636; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=u1nisTy6lw7HXt2aKNr+FUe0wDrA0s3HuQr4p3ZdaGM=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXiNCG8tyCSxKN3kyVGSnoK8GAQjKKgxHRo/sI Np+AchtdlqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV4jQgAKCRD6PaqMvJYe 9dqFEACSftGXAoVevIBDnb3q0rTlPZny91bXjdXDxnV9fVeZSi4YjSd4M269UlGDO5i+ixpsa6Y 4GK/dI8d/oc5ocdLH+XM/6QqXmK2EhkZ/cJZ+teRHe+Mmc1p33f/mPgO2Fl1j5vksBF1y75bQzh wbxEnPdVF04szYRoz3E2UZ3i5DPdb1YXHPryCgcjpx6U8bJvyGnskYtfUIY+Je8f12h8O2urV6i LCMphQMCO8kNGuLOdLpLjMwJIcjgMwdqhYGN46G5d137Xb6PFXbSREDoRPh8ewH5V1xoJENa1JI gUc1bZevj56dvoN2HG9yBs5x6GXuK1pnVL44ByKTeJKnY3R8oadV98xQjTBR8rGdbXVz/b5QqLj tTq8bocqAMc7Dno+DMwRuL8tZi4mvQFMSo2ApyfbyRbjAAPrWOGMeUQIzyT4RJZNRpK/aXWKVIv rXWwCeij9caoOFmeAQbGMv3jSTuWMI2MChbdzJ0VsScBpNS6eENKIWay1rbxpMIB1SbWrh14/kR 6SoT7Kd5+8tc18lATCWrVV6ckXFMdDUEne30zG4PthOOU+f0YfBarw2cMbsXdd7kjllYogFoJ00 3qLinFquurDAno7UTC2phhfx+CSXYfMSl991Im27Bz/WB8Q3cGNDsjJyIZn3tICxDUB0ukEbmmU Sq5b+kzGzk7/lfg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 08:12:54 -0800 (PST) Add missing calls to media_device_cleanup() to fix memory leak. Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") Reviewed-by: Laurent Pinchart Reviewed-by: Tommaso Merciai Signed-off-by: Tomi Valkeinen --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index c41abd2833f1..894d5afaff4e 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -582,7 +582,7 @@ static int rkisp1_probe(struct platform_device *pdev) ret = v4l2_device_register(rkisp1->dev, &rkisp1->v4l2_dev); if (ret) - goto err_pm_runtime_disable; + goto err_media_dev_cleanup; ret = media_device_register(&rkisp1->media_dev); if (ret) { @@ -617,6 +617,8 @@ static int rkisp1_probe(struct platform_device *pdev) media_device_unregister(&rkisp1->media_dev); err_unreg_v4l2_dev: v4l2_device_unregister(&rkisp1->v4l2_dev); +err_media_dev_cleanup: + media_device_cleanup(&rkisp1->media_dev); err_pm_runtime_disable: pm_runtime_disable(&pdev->dev); return ret; @@ -637,6 +639,8 @@ static void rkisp1_remove(struct platform_device *pdev) media_device_unregister(&rkisp1->media_dev); v4l2_device_unregister(&rkisp1->v4l2_dev); + media_device_cleanup(&rkisp1->media_dev); + pm_runtime_disable(&pdev->dev); } -- 2.34.1