From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Maxime Ripard <mripard@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-media@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v2 1/2] media: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe()
Date: Tue, 23 Aug 2022 14:15:24 +0200 [thread overview]
Message-ID: <YwTE3JhyTpGmgqpU@aptenodytes> (raw)
In-Reply-To: <28d04b260acff7eb4416a410d5678cbafb5e2784.1661240416.git.christophe.jaillet@wanadoo.fr>
[-- Attachment #1: Type: text/plain, Size: 4164 bytes --]
Hi Christophe,
On Tue 23 Aug 22, 09:42, Christophe JAILLET wrote:
> Release some resources in the error handling path of the probe and of
> sun8i_a83t_mipi_csi2_resources_setup(), as already done in the remove
> function.
Looks good to me, thanks!
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> Fixes: 576d196c522b ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I'm unsure about the phy_exit() call in
> sun8i_a83t_mipi_csi2_resources_cleanup() because no explicit phy_init()
> call is performed.
>
> The same code is in sun6i-mipi-csi2/sun6i_mipi_csi2.c, but in this driver
> phy_init() IS called.
>
> I leave it as-is because I don't if it is an issue or not.
> My feeling is that it is a copy'n'paste error and that it should be
> removed.
Actually it's a legitimate call. The d-phy is internal on A83T and it's
registered in sun8i_a83t_dphy_register, which is called from
sun8i_a83t_mipi_csi2_resources_setup.
Cheers,
Paul
> Changes in v2:
> * add some blank line [Paul Kocialkowski <paul.kocialkowski@bootlin.com>]
> * rename the new labels [Paul Kocialkowski <paul.kocialkowski@bootlin.com>]
>
> v1:
> https://lore.kernel.org/all/62c0aef8d3b86d8f290bf6787f1b2b41efbb0b55.1659295329.git.christophe.jaillet@wanadoo.fr/
> ---
> .../sun8i_a83t_mipi_csi2.c | 23 +++++++++++++++----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
> index d052ee77ef0a..b032ec13a683 100644
> --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
> +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
> @@ -719,13 +719,15 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
> csi2_dev->clock_mipi = devm_clk_get(dev, "mipi");
> if (IS_ERR(csi2_dev->clock_mipi)) {
> dev_err(dev, "failed to acquire mipi clock\n");
> - return PTR_ERR(csi2_dev->clock_mipi);
> + ret = PTR_ERR(csi2_dev->clock_mipi);
> + goto error_clock_rate_exclusive;
> }
>
> csi2_dev->clock_misc = devm_clk_get(dev, "misc");
> if (IS_ERR(csi2_dev->clock_misc)) {
> dev_err(dev, "failed to acquire misc clock\n");
> - return PTR_ERR(csi2_dev->clock_misc);
> + ret = PTR_ERR(csi2_dev->clock_misc);
> + goto error_clock_rate_exclusive;
> }
>
> /* Reset */
> @@ -733,7 +735,8 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
> csi2_dev->reset = devm_reset_control_get_shared(dev, NULL);
> if (IS_ERR(csi2_dev->reset)) {
> dev_err(dev, "failed to get reset controller\n");
> - return PTR_ERR(csi2_dev->reset);
> + ret = PTR_ERR(csi2_dev->reset);
> + goto error_clock_rate_exclusive;
> }
>
> /* D-PHY */
> @@ -741,7 +744,7 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
> ret = sun8i_a83t_dphy_register(csi2_dev);
> if (ret) {
> dev_err(dev, "failed to initialize MIPI D-PHY\n");
> - return ret;
> + goto error_clock_rate_exclusive;
> }
>
> /* Runtime PM */
> @@ -749,6 +752,11 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
> pm_runtime_enable(dev);
>
> return 0;
> +
> +error_clock_rate_exclusive:
> + clk_rate_exclusive_put(csi2_dev->clock_mod);
> +
> + return ret;
> }
>
> static void
> @@ -778,9 +786,14 @@ static int sun8i_a83t_mipi_csi2_probe(struct platform_device *platform_dev)
>
> ret = sun8i_a83t_mipi_csi2_bridge_setup(csi2_dev);
> if (ret)
> - return ret;
> + goto error_resources;
>
> return 0;
> +
> +error_resources:
> + sun8i_a83t_mipi_csi2_resources_cleanup(csi2_dev);
> +
> + return ret;
> }
>
> static int sun8i_a83t_mipi_csi2_remove(struct platform_device *platform_dev)
> --
> 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 --]
prev parent reply other threads:[~2022-08-23 12:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 7:42 [PATCH v2 1/2] media: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe() Christophe JAILLET
2022-08-23 7:42 ` [PATCH v2 2/2] media: sunxi: Fix some error handling path of sun6i_mipi_csi2_probe() Christophe JAILLET
2022-08-23 12:16 ` Paul Kocialkowski
2022-08-23 12:15 ` Paul Kocialkowski [this message]
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=YwTE3JhyTpGmgqpU@aptenodytes \
--to=paul.kocialkowski@bootlin.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jernej.skrabec@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/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