From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Maxime Ripard <mripard@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v4 2/2] media: i2c: Add support for the OV5648 image sensor
Date: Wed, 9 Dec 2020 01:34:36 +0200 [thread overview]
Message-ID: <20201208233436.GF25763@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20201128143350.531460-3-paul.kocialkowski@bootlin.com>
Hi Paul,
On Sat, Nov 28, 2020 at 03:33:50PM +0100, Paul Kocialkowski wrote:
...
> + if (ret)
> + goto error_ctrls;
> +
> + /* V4L2 subdev register */
> +
> + ret = v4l2_async_register_subdev_sensor_common(subdev);
The driver's device node may be already available to the user here...
> + if (ret)
> + goto error_ctrls;
> +
> + /* Runtime PM */
> +
> + pm_runtime_enable(sensor->dev);
> + pm_runtime_set_suspended(sensor->dev);
but runtime PM is enabled here.
This needs to be done in a different order. Otherwise chances are that the
device node is accessed before the device is powered on.
> +
> + return 0;
> +
> +error_ctrls:
> + v4l2_ctrl_handler_free(&sensor->ctrls.handler);
> +
> +error_mutex:
> + mutex_destroy(&sensor->mutex);
> +
> +error_entity:
> + media_entity_cleanup(&sensor->subdev.entity);
> +
> +error_endpoint:
> + v4l2_fwnode_endpoint_free(&sensor->endpoint);
> +
> + return ret;
> +}
> +
> +static int ov5648_remove(struct i2c_client *client)
> +{
> + struct v4l2_subdev *subdev = i2c_get_clientdata(client);
> + struct ov5648_sensor *sensor = ov5648_subdev_sensor(subdev);
> +
> + clk_rate_exclusive_put(sensor->xvclk);
> +
> + v4l2_async_unregister_subdev(subdev);
> + mutex_destroy(&sensor->mutex);
> + media_entity_cleanup(&subdev->entity);
> + v4l2_device_unregister_subdev(subdev);
> + pm_runtime_disable(sensor->dev);
> +
> + ov5648_sensor_power(sensor, false);
This needs to go, too, as there's no corresponding operation that powered
on the device.
Also don't forget to release the control handler.
I believe these apply to both of the two drivers.
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2020-12-08 23:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 14:33 [PATCH v4 0/2] media: i2c: OV5648 image sensor support Paul Kocialkowski
2020-11-28 14:33 ` [PATCH v4 1/2] dt-bindings: media: i2c: Add OV5648 bindings documentation Paul Kocialkowski
2020-11-28 14:33 ` [PATCH v4 2/2] media: i2c: Add support for the OV5648 image sensor Paul Kocialkowski
2020-11-30 9:28 ` Sakari Ailus
2020-11-30 13:48 ` Paul Kocialkowski
2020-11-30 13:53 ` Sakari Ailus
2020-12-02 13:50 ` Paul Kocialkowski
2020-12-08 23:34 ` Sakari Ailus [this message]
2020-12-09 14:05 ` Paul Kocialkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201208233436.GF25763@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox