Message ID | 20231122-rkisp-fixes-v1-1-1958af371e39@ideasonboard.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1371896vqb; Wed, 22 Nov 2023 06:43:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUmPmZnfT3G8Mbb2ruu1irOu/v/RScydbyLl804qd59nKIxDD8O/f320ldPSvRZiIMSQpD X-Received: by 2002:a17:903:483:b0:1cc:51b8:8100 with SMTP id jj3-20020a170903048300b001cc51b88100mr2446441plb.7.1700664183304; Wed, 22 Nov 2023 06:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700664183; cv=none; d=google.com; s=arc-20160816; b=JTAzqOwkq4gZr2/kIpvPPTHA33FYKGy9s7D2BE1NREu5sB3Vn7f6Sgivdg6hyQs0dc Y/BKQ3UXlOqiAZSLa9VkzKoTWUuw+AzhQqzhq7pAc8tG4P8X++3K3iMj9hn62w8Q6nXR p5oM845T7nB41671hpuGgXAYUMlwxD2tkwWJhXy50RQMkitKb90aFQx16DkdikxjE4a6 sJsXOy4i2QSgzdLfkk25H36+H1kG/Aatjv89BlUgtnCAVUx2Z8WBFXh/ltlHNVAKSkVj Lw7geuKgeqYPz4QLZJrL/O7FwmcV5vmo7jXaFjzzYSdW+CZdTLSU4hYyg9cZxQzLwtd8 UfQw== 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=2EL/Xw6nMeUkAeZrfcvOTNtd5gQlTm8xPyn+maHo/kQ=; fh=e2+FywPT74OKeNAVnhPDEB5sc4CoF2aRKIHvw6X2EL4=; b=Hta8GjdiYAzxnm8aK2EnorIOLQHsqAXnrb21NoqawVFWO7bm+rYfUHYJxgX53VgeYP GMtqE9xXgVhxZesuETAUY3ZB166s95mANhKMj/gLC20Kdp9Jh7apSXBKE2Kk656nvXEM /+/bc4JCVfRY3V4RlFEwMYkyIfJUANUiEl4k8aeZqzM438QVwg1iL+wJFbzHSIGJSEHi lxZ56mftRBaUmfw/nteDbV+kaU1M+3Wr2AVrUMHNHopdZxLEndX/jvOF1UDGyLgBMdov qnRz1Vw1ptE0uKSYgiRstkxzuII3lw+mq1QUvS9QkODDf6gTtAl5c6x37KC5PIXq2SpZ 4u8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=YP9asx6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l18-20020a170902eb1200b001bf1d1d99b0si12227332plb.568.2023.11.22.06.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 06:43:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=YP9asx6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id ECC6881A3367; Wed, 22 Nov 2023 06:43:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343836AbjKVOm7 (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Wed, 22 Nov 2023 09:42:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231653AbjKVOmz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Nov 2023 09:42:55 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A27497; Wed, 22 Nov 2023 06:42:51 -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 4232E641; Wed, 22 Nov 2023 15:42:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700664138; bh=m/zEIfXXTHvQjozZAyjiA6eqZQPUBkii1euXSnYoOvE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YP9asx6SDnlDNjkOD34Fz3GV/GuZuWTjB9tLPdQb3cvh1GK1PGI3jnm/eoIe+qFGt Diywgb9kB03JB7zlTkKO6R2NPSgJVqBuV1vtxTIN/2B1j8YAfFEoaZcek6ocFAHg8D o7I9SHopGhyZxZ4N8VMmkC9fjLblP1g+CHIv5hJQ= From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Date: Wed, 22 Nov 2023 16:42:22 +0200 Subject: [PATCH 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-v1-1-1958af371e39@ideasonboard.com> References: <20231122-rkisp-fixes-v1-0-1958af371e39@ideasonboard.com> In-Reply-To: <20231122-rkisp-fixes-v1-0-1958af371e39@ideasonboard.com> To: Dafna Hirschfeld <dafna@fastmail.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Heiko Stuebner <heiko@sntech.de>, Jacob Chen <jacob2.chen@rock-chips.com>, Yichong Zhong <zyc@rock-chips.com>, Shunqian Zheng <zhengsq@rock-chips.com>, Paul Elder <paul.elder@ideasonboard.com>, Sakari Ailus <sakari.ailus@linux.intel.com> Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Eddie Cai <eddie.cai.linux@gmail.com>, Allon Huang <allon.huang@rock-chips.com>, Jeffy Chen <jeffy.chen@rock-chips.com>, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1184; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=m/zEIfXXTHvQjozZAyjiA6eqZQPUBkii1euXSnYoOvE=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXhNmoGXYrkOE3AdB7Fp5rvOueSko64nRBHCyK qKps9vLkRSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV4TZgAKCRD6PaqMvJYe 9V4vD/9mS6a40zwMwT1NDJ+tXjKAo93DSsj3Q6ByOm9ye0/hPin7RMgZVFGa4q+ojuJnwwONjDb +TK2xaI3pQwgrd53zTS6cgTB0wcYLzShBoNMiDZpUP2jqM+p7vGfI/fAsGsphM67OoTNRh8VuBU oXYpKWgfgfIpiUujcLk9JbxzvnHQL8jZBV8xw2bjdxHuGovFWRGcegiCmF957Nyip8OJzNrP1tj X/wqq2vsdxdRmRTAF+WhqEAZBoJRlCCsV8k0R3hbemf/NgPoff+0Slnz9Iv8tIC1ffof83vNKu1 U4nsbEEjIiCuOiVTWhE2+kTwcqThZXjWCPXzPJq3xNTugvYDmrCrl0l6cgti8n7XuhwqS7UJzvL BFuslCUgclBqOldOfLOFAMRm7tSlUqjdc3K2E3BZtCndzqO9zbrnCfSV4JqaUGAmfapIlm5ltRh NnIyIjIHo5t1v61964DsmBk+ezYh/uBBsNhvsi5vHJSo2JNqhUJWxw+1tZxqxuQ6QJ6rgXXHp6k lHOi0yBTgq9a4lbBdORqVHGG4WB2maQJq6egxHqmh1KU6N77c+Iw/5nNxqXHn/W/lmXQYV5Wrvf 3BXb86pagpZjhXhsf7Qe7+CZ089UsFY+/dvlLlqtt5wWgZ/wxkhTiNLevHl9FJhIh+eDhsd8Q6L 6VkHW9jMtVkw7AA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 06:43:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783275646324258921 X-GMAIL-MSGID: 1783275646324258921 |
Series |
media: rkisp1: Fix memory leaks
|
|
Commit Message
Tomi Valkeinen
Nov. 22, 2023, 2:42 p.m. UTC
Add missing calls to media_device_cleanup() to fix memory leak.
Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Tomi, On Wed, Nov 22, 2023 at 04:42:22PM +0200, Tomi Valkeinen wrote: > Add missing calls to media_device_cleanup() to fix memory leak. > > Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> > --- > drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > index c41abd2833f1..e10cc2881757 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > @@ -617,6 +617,7 @@ static int rkisp1_probe(struct platform_device *pdev) > media_device_unregister(&rkisp1->media_dev); > err_unreg_v4l2_dev: > v4l2_device_unregister(&rkisp1->v4l2_dev); > + media_device_cleanup(&rkisp1->media_dev); > err_pm_runtime_disable: > pm_runtime_disable(&pdev->dev); > return ret; > @@ -637,6 +638,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); > } Looks good to me. Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com> Thanks & Regards, Tommaso > > > -- > 2.34.1 > >
Hi Tomi, Thank you for the patch. On Wed, Nov 22, 2023 at 04:42:22PM +0200, Tomi Valkeinen wrote: > Add missing calls to media_device_cleanup() to fix memory leak. > > Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> > --- > drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > index c41abd2833f1..e10cc2881757 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > @@ -617,6 +617,7 @@ static int rkisp1_probe(struct platform_device *pdev) > media_device_unregister(&rkisp1->media_dev); > err_unreg_v4l2_dev: > v4l2_device_unregister(&rkisp1->v4l2_dev); > + media_device_cleanup(&rkisp1->media_dev); As media_device_cleanup() cleans up for media_device_init(), shouldn't it go to the err_pm_runtime_disable label ? The label may need to be renamed to err_media_cleanup then. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > err_pm_runtime_disable: > pm_runtime_disable(&pdev->dev); > return ret; > @@ -637,6 +638,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); > } >
On 22/11/2023 17:42, Laurent Pinchart wrote: > Hi Tomi, > > Thank you for the patch. > > On Wed, Nov 22, 2023 at 04:42:22PM +0200, Tomi Valkeinen wrote: >> Add missing calls to media_device_cleanup() to fix memory leak. >> >> Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> >> --- >> drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >> index c41abd2833f1..e10cc2881757 100644 >> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >> @@ -617,6 +617,7 @@ static int rkisp1_probe(struct platform_device *pdev) >> media_device_unregister(&rkisp1->media_dev); >> err_unreg_v4l2_dev: >> v4l2_device_unregister(&rkisp1->v4l2_dev); >> + media_device_cleanup(&rkisp1->media_dev); > > As media_device_cleanup() cleans up for media_device_init(), shouldn't > it go to the err_pm_runtime_disable label ? The label may need to be > renamed to err_media_cleanup then. Oops, you're right. I'll fix that. Tomi > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > >> err_pm_runtime_disable: >> pm_runtime_disable(&pdev->dev); >> return ret; >> @@ -637,6 +638,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); >> } >> >
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index c41abd2833f1..e10cc2881757 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -617,6 +617,7 @@ static int rkisp1_probe(struct platform_device *pdev) media_device_unregister(&rkisp1->media_dev); err_unreg_v4l2_dev: v4l2_device_unregister(&rkisp1->v4l2_dev); + media_device_cleanup(&rkisp1->media_dev); err_pm_runtime_disable: pm_runtime_disable(&pdev->dev); return ret; @@ -637,6 +638,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); }