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: 168426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1435706vqb; Wed, 22 Nov 2023 08:12:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IENt35HYdzdLX20yGcDNAnb+p31g7qCbU5n6DjnFbcvDwHJhVb+G+mnl24OhSauZEVcjU9n X-Received: by 2002:a05:6808:2195:b0:3b6:cb02:533b with SMTP id be21-20020a056808219500b003b6cb02533bmr3249631oib.44.1700669566930; Wed, 22 Nov 2023 08:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700669566; cv=none; d=google.com; s=arc-20160816; b=DQWjOxLi+cp6r+7630EMLYmqMnE1arEsc5tb6hUNGd+/o0cmmDsZpQBdu3u2cqdfNk HnH1f6tRcGwv8jJ7FyHz6bqbRtEymSNE3yDLNymubZ4j2d7TJMJ+ixYDYGcocRPAc5Xp k12UsdBMmVJVGAXj15AlvMt8uxc3yrRiKHR1P+Hhsa8Jez/8xpqgHwuIsjm0+NRqb2LF klkHn0dFufuJ2qoESMk2duqHtne+mR7bcteVPrhvhsv8Dejks4lhlPLimCy7Z4PXDMuw LdHyX0heLRlUJ1ubrhq4sm8RK291qIy4qxogDawk3OLJ541HfR3hfKeh/VFccDuCEwOa KN0Q== 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 Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q204-20020a632ad5000000b005c18dd91684si12532900pgq.352.2023.11.22.08.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:12:46 -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 F0AF981DDBC6; Wed, 22 Nov 2023 08:12:39 -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 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:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783281291825163544 X-GMAIL-MSGID: 1783281291825163544 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: 168418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1420484vqb; Wed, 22 Nov 2023 07:52:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+bKbOlV2o+QmPb05BOsTrwxTbNQBdssdXR5CA52Iz/TKxjr8UYWPaH4Cbf8wYKlLyUgWW X-Received: by 2002:a05:6a00:3992:b0:6c3:41fd:3a3e with SMTP id fi18-20020a056a00399200b006c341fd3a3emr2797774pfb.27.1700668362020; Wed, 22 Nov 2023 07:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700668362; cv=none; d=google.com; s=arc-20160816; b=tJzd+oBXgOT7K8XxBvRUa06aMmGSY4ujqkNx33b0E+C6z9tdwgbD8La9g27iKbLqmA V33bmezqh3HFwqx7MbnywCBTkAbny0Wsg3f5N4H1h4CvUnkkrBGLYXdVwzzPrOW0hRcd zAcwSjRU99UtYRN5ZjSEpVhiaHnXv+oOLizmBCHM6WnIzC/oZKDotvf83gfyQUL/IkIE ZAg3aZxXt1xYjS93T9ZhqowHzbpiS8x2h9vmksVILBv6MaCM3z+cim56mBlASSS230AS j3w2lttmx4gi5Qngd5dnIdx2mY218GCN5N7AyU8sCJOOcwwmMIgp3yNQAGZG+5VsJBIG Sqew== 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=UmsgZ4R6XqjmqCQftlhBfy4T1UOhevwpoOXfrsC3Yqk=; fh=C0dXkAvu/VipV4SxI6kL8WioTQwoH+s7n35QCI5Zld8=; b=YiGC6TfFKQsJWMsgMDJeIUGIWRDsHxLyVLN/9hjsE+eLlg9Tq1/XS1kNc/p7PZXIGR GAj1UUqLOZ0g+kQyVRoFUNoLHbHD1PyzwBQRtivZ9HtpEh3pl/hDd7pCPRD1VUuxT9cM jvG45rzWQZLEyQf3AS1VFop00RcOBN8VyuvrwybRcuDWgL8OxeNnGruJ2Ygu1j6rOr3j 3pD0lZqFj/Z26bIpDTyAeXXFQKnP0BqKYGSkSZsiJiJcEVq+/3dDKJLSOwxPlO36klyE I4lGziiS6ATgtBCM8EymIOO1hq4YeXe18bZ3c9LCUqVtNgmXQ48JeXIeGkclghisrk+T M2Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hwzEUySD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g17-20020a63fa51000000b005b902b61cbbsi12781719pgk.125.2023.11.22.07.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:52:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hwzEUySD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id A3F8182AA64C; Wed, 22 Nov 2023 07:52:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344473AbjKVPvD (ORCPT + 99 others); Wed, 22 Nov 2023 10:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbjKVPug (ORCPT ); Wed, 22 Nov 2023 10:50:36 -0500 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() 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 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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:52:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783280028298151549 X-GMAIL-MSGID: 1783280028298151549 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); }