* [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind
@ 2022-09-19 2:32 Rafael Mendonca
2022-09-19 14:32 ` Tommaso Merciai
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rafael Mendonca @ 2022-09-19 2:32 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Paul Kocialkowski, Sakari Ailus
Cc: Rafael Mendonca, Mauro Carvalho Chehab, linux-media, linux-kernel
The V4L2 fwnode data structure doesn't get freed on unbind, which leads to
a memleak.
Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
---
drivers/media/i2c/ov5648.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c
index dfcd33e9ee13..95850f06112b 100644
--- a/drivers/media/i2c/ov5648.c
+++ b/drivers/media/i2c/ov5648.c
@@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client)
mutex_destroy(&sensor->mutex);
media_entity_cleanup(&subdev->entity);
+ v4l2_fwnode_endpoint_free(&sensor->endpoint);
+
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind 2022-09-19 2:32 [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind Rafael Mendonca @ 2022-09-19 14:32 ` Tommaso Merciai 2022-09-20 12:46 ` Jacopo Mondi 2022-09-20 13:25 ` Paul Kocialkowski 2 siblings, 0 replies; 6+ messages in thread From: Tommaso Merciai @ 2022-09-19 14:32 UTC (permalink / raw) To: Rafael Mendonca Cc: Mauro Carvalho Chehab, Paul Kocialkowski, Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel Hi Rafael, On Sun, Sep 18, 2022 at 11:32:46PM -0300, Rafael Mendonca wrote: > The V4L2 fwnode data structure doesn't get freed on unbind, which leads to > a memleak. > > Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") > Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> > --- > drivers/media/i2c/ov5648.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c > index dfcd33e9ee13..95850f06112b 100644 > --- a/drivers/media/i2c/ov5648.c > +++ b/drivers/media/i2c/ov5648.c > @@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client) > mutex_destroy(&sensor->mutex); > media_entity_cleanup(&subdev->entity); > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > + > return 0; > } > > -- > 2.34.1 > Looks good to me. Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Regards, Tommaso -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind 2022-09-19 2:32 [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind Rafael Mendonca 2022-09-19 14:32 ` Tommaso Merciai @ 2022-09-20 12:46 ` Jacopo Mondi 2022-09-20 13:25 ` Paul Kocialkowski 2 siblings, 0 replies; 6+ messages in thread From: Jacopo Mondi @ 2022-09-20 12:46 UTC (permalink / raw) To: Rafael Mendonca Cc: Mauro Carvalho Chehab, Paul Kocialkowski, Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel Hi Rafael On Sun, Sep 18, 2022 at 11:32:46PM -0300, Rafael Mendonca wrote: > The V4L2 fwnode data structure doesn't get freed on unbind, which leads to > a memleak. > > Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") > Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> > --- > drivers/media/i2c/ov5648.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c > index dfcd33e9ee13..95850f06112b 100644 > --- a/drivers/media/i2c/ov5648.c > +++ b/drivers/media/i2c/ov5648.c > @@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client) > mutex_destroy(&sensor->mutex); > media_entity_cleanup(&subdev->entity); > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > + Nit: all the other function calls are in a single block, this one doesn't deserve an empty line before it. Nit apart, the patch is a good fix. > return 0; > } > > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind 2022-09-19 2:32 [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind Rafael Mendonca 2022-09-19 14:32 ` Tommaso Merciai 2022-09-20 12:46 ` Jacopo Mondi @ 2022-09-20 13:25 ` Paul Kocialkowski 2022-09-20 13:58 ` Rafael Mendonca 2 siblings, 1 reply; 6+ messages in thread From: Paul Kocialkowski @ 2022-09-20 13:25 UTC (permalink / raw) To: Rafael Mendonca Cc: Mauro Carvalho Chehab, Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1175 bytes --] Hi Rafael, On Sun 18 Sep 22, 23:32, Rafael Mendonca wrote: > The V4L2 fwnode data structure doesn't get freed on unbind, which leads to > a memleak. Thanks for this patch, good catch! I agree with Jacopo, you shouldn't add a newline before the call. Feel free to send a v2 with that fixed and include my: Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Cheers, Paul > Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") > Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> > --- > drivers/media/i2c/ov5648.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c > index dfcd33e9ee13..95850f06112b 100644 > --- a/drivers/media/i2c/ov5648.c > +++ b/drivers/media/i2c/ov5648.c > @@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client) > mutex_destroy(&sensor->mutex); > media_entity_cleanup(&subdev->entity); > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > + > return 0; > } > > -- > 2.34.1 > -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind 2022-09-20 13:25 ` Paul Kocialkowski @ 2022-09-20 13:58 ` Rafael Mendonca 2022-09-20 14:07 ` Paul Kocialkowski 0 siblings, 1 reply; 6+ messages in thread From: Rafael Mendonca @ 2022-09-20 13:58 UTC (permalink / raw) To: Paul Kocialkowski Cc: Mauro Carvalho Chehab, Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel On Tue, Sep 20, 2022 at 03:25:20PM +0200, Paul Kocialkowski wrote: > Hi Rafael, > > On Sun 18 Sep 22, 23:32, Rafael Mendonca wrote: > > The V4L2 fwnode data structure doesn't get freed on unbind, which leads to > > a memleak. > > Thanks for this patch, good catch! > > I agree with Jacopo, you shouldn't add a newline before the call. Thanks for the review, I'll send a v2. As the code for the ov5648 is similar to the ov8865, and in the 8865 there is this blank line before the v4l2_fwnode_endpoint_free() call, I thought it might be good to keep the same style here, that's why this empty line ended up appearing here. > Feel free to send a v2 with that fixed and include my: > > Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> > > Cheers, > > Paul > > > Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") > > Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> > > --- > > drivers/media/i2c/ov5648.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c > > index dfcd33e9ee13..95850f06112b 100644 > > --- a/drivers/media/i2c/ov5648.c > > +++ b/drivers/media/i2c/ov5648.c > > @@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client) > > mutex_destroy(&sensor->mutex); > > media_entity_cleanup(&subdev->entity); > > > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > > + > > return 0; > > } > > > > -- > > 2.34.1 > > > > -- > Paul Kocialkowski, Bootlin > Embedded Linux and kernel engineering > https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind 2022-09-20 13:58 ` Rafael Mendonca @ 2022-09-20 14:07 ` Paul Kocialkowski 0 siblings, 0 replies; 6+ messages in thread From: Paul Kocialkowski @ 2022-09-20 14:07 UTC (permalink / raw) To: Rafael Mendonca Cc: Mauro Carvalho Chehab, Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel [-- Attachment #1: Type: text/plain, Size: 2033 bytes --] Hi Rafael, On Tue 20 Sep 22, 10:58, Rafael Mendonca wrote: > On Tue, Sep 20, 2022 at 03:25:20PM +0200, Paul Kocialkowski wrote: > > Hi Rafael, > > > > On Sun 18 Sep 22, 23:32, Rafael Mendonca wrote: > > > The V4L2 fwnode data structure doesn't get freed on unbind, which leads to > > > a memleak. > > > > Thanks for this patch, good catch! > > > > I agree with Jacopo, you shouldn't add a newline before the call. > > Thanks for the review, I'll send a v2. As the code for the ov5648 is > similar to the ov8865, and in the 8865 there is this blank line before > the v4l2_fwnode_endpoint_free() call, I thought it might be good to keep > the same style here, that's why this empty line ended up appearing here. Understood! I'd be tempted to make a cosmetic fix for 8865 but will probably wait to group it with functional changes. Cheers, Paul > > Feel free to send a v2 with that fixed and include my: > > > > Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> > > > > Cheers, > > > > Paul > > > > > Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") > > > Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> > > > --- > > > drivers/media/i2c/ov5648.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c > > > index dfcd33e9ee13..95850f06112b 100644 > > > --- a/drivers/media/i2c/ov5648.c > > > +++ b/drivers/media/i2c/ov5648.c > > > @@ -2598,6 +2598,8 @@ static int ov5648_remove(struct i2c_client *client) > > > mutex_destroy(&sensor->mutex); > > > media_entity_cleanup(&subdev->entity); > > > > > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > > > + > > > return 0; > > > } > > > > > > -- > > > 2.34.1 > > > > > > > -- > > Paul Kocialkowski, Bootlin > > Embedded Linux and kernel engineering > > https://bootlin.com > > -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-20 14:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-19 2:32 [PATCH] media: i2c: ov5648: Free V4L2 fwnode data on unbind Rafael Mendonca 2022-09-19 14:32 ` Tommaso Merciai 2022-09-20 12:46 ` Jacopo Mondi 2022-09-20 13:25 ` Paul Kocialkowski 2022-09-20 13:58 ` Rafael Mendonca 2022-09-20 14:07 ` Paul Kocialkowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox