From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Ripard Subject: Re: [PATCH 3/5] media: sunxi: Add A10 CSI driver Date: Thu, 22 Nov 2018 14:58:53 +0100 Message-ID: <20181122135853.4rpxb32d6ios5zac@flea> References: <20181115205106.thbkojnzdwmaeui3@flea> <20181121220102.6nn7uwu2c67zs6pz@mara.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3quxuh5gpkv3x7ke" Return-path: Content-Disposition: inline In-Reply-To: <20181121220102.6nn7uwu2c67zs6pz@mara.localdomain> Sender: linux-kernel-owner@vger.kernel.org To: Sakari Ailus Cc: Hans Verkuil , Hans Verkuil , Mauro Carvalho Chehab , Thomas Petazzoni , Laurent Pinchart , linux-media@vger.kernel.org, Andrzej Hajda , Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Mark Rutland , Rob Herring , Frank Rowand List-Id: devicetree@vger.kernel.org --3quxuh5gpkv3x7ke Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Sakari, On Thu, Nov 22, 2018 at 12:01:03AM +0200, Sakari Ailus wrote: > On Thu, Nov 15, 2018 at 09:51:06PM +0100, Maxime Ripard wrote: > > Hi Hans, > >=20 > > Thanks for your review! I'll address the other comments you made. > >=20 > > On Tue, Nov 13, 2018 at 01:24:47PM +0100, Hans Verkuil wrote: > > > > +static int csi_probe(struct platform_device *pdev) > > > > +{ > > > > + struct sun4i_csi *csi; > > > > + struct resource *res; > > > > + int ret; > > > > + int irq; > > > > + > > > > + csi =3D devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); > > >=20 > > > devm_kzalloc is not recommended: all devm_ memory is freed when the d= river > > > is unbound, but a filehandle might still have a reference open. > >=20 > > How would a !devm variant with a kfree in the remove help? We would > > still fall in the same case, right? >=20 > Not quite. For video nodes this is handled: the release callback gets cal= led > once there are no file handles open to the device. That may well be much > later than the device has been unbound from the driver. I might be missing something, but how the release callback will be able to get the reference to the structure we allocated here so that it can free it? Thanks! Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --3quxuh5gpkv3x7ke Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW/a2HQAKCRDj7w1vZxhR xeYmAP9yPJlEhJ3rYDcEmTa7fnMkqikKNh6ty85vrrlg+FCEBgD/Xvwbv+mZKRbm TOU2UTA8aEpKmFShx9jEqRewxE1iDQw= =+FLC -----END PGP SIGNATURE----- --3quxuh5gpkv3x7ke--