From patchwork Wed Nov 22 15:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13465071 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="aRXmXmYT" 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 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); } From patchwork Wed Nov 22 15:50:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13465072 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hwzEUySD" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23310D42; Wed, 22 Nov 2023 07:50:33 -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 C84F2641; Wed, 22 Nov 2023 16:49:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700668199; bh=GWSvmigvhbqxxKwsO8s1wxYTODF1EHzXekCVLlbZGxI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hwzEUySDhdg7+rV4lAQv1SLbaMq4f5LP3XGp0v8sHnCVXjnUyl0SO7+KttWy3qd2V ONCgstHK1hey+zQcUHwkd7jQB80umbQ68bN4Z1oIfOBPCFBF3Fb1GgBwHFHmMTjTby 0u85d2oWQM5WqA6W6rSwkwJa2jMvx9VPIjAT6N+I= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 17:50:08 +0200 Subject: [PATCH v2 2/2] media: rkisp1: Fix memory leaks in rkisp1_isp_unregister() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231122-rkisp-fixes-v2-2-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=940; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=GWSvmigvhbqxxKwsO8s1wxYTODF1EHzXekCVLlbZGxI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXiNCOLg/ZNZkH5JNt4+lP3cqdiX2JgWJ0yFPo ckl7sgXzkyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV4jQgAKCRD6PaqMvJYe 9fWRD/9StEmHs8CUsFrm3u/UhmQD6eVyKBwAImdgigY4oTPn41xWao/S59SXpr3e88F9bXGxcMZ 6rnSXhmN7BDKXLKnWttYjjKhkYpLSaxegHh55Z4xtfr3u0wXzdWcC3NEH6HS94P48DjKHuHzzBU Gr04pONVTSW+ns9cdVhJynYL2qzL4V2BFb7hQYKS1rAazEYhCVoUaC1EfEs0xm6wt5nk2HQGlP0 tIpbqw+/2Jld19VUWran31Omv5uB+Z0RjRLRodX4vu0505piKnTt78v4Kly6xUU73WgIlh7YCp+ 9rknI0dcamE4ZCdv+dlCjENspgLNgfP1/09L2urGYQTcd6ggOttdO2Qg0KBfzcDTbrBVp64qQMn qFF6wovam1VktcLAFtH9crxOKWo+ZP8OU53xXj9IqpVQDO0mKZ5kYhKBzjU6t6tzXu2Z2d5uWgk TuSwTAfKKFRgjBn23rCbc3xzX53yKDURqxeNH6ZbTmA54ulm0vAlKwKb8uXgk1axttXuXaNMkoe Qp0vaz6pijRptgcMSEjMpeKY0xgjMsz8cCWG377otml93uq9BKemmP0IAZMNLb5d4KBs40Vz725 y81xyOlm4aUtZfRvZvRNkx8Y22HHL2YhtupQjAel9hxFF1W3kcuGso4wuqky0GaAz9Qqf0zHZEj 5JAOoWZlF2PmAFw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add missing call to v4l2_subdev_cleanup() to fix memory leak. Fixes: 2cce0a369dbd ("media: rkisp1: isp: Use V4L2 subdev active state") Reviewed-by: Tommaso Merciai Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c index 88ca8b2283b7..45d1ab96fc6e 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c @@ -933,6 +933,7 @@ void rkisp1_isp_unregister(struct rkisp1_device *rkisp1) return; v4l2_device_unregister_subdev(&isp->sd); + v4l2_subdev_cleanup(&isp->sd); media_entity_cleanup(&isp->sd.entity); }