lkml.org 
[lkml]   [2022]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] media: sunxi: Fix some error handling path of sun6i_mipi_csi2_probe()
Hi Christophe,

On Sun 31 Jul 22, 21:22, Christophe JAILLET wrote:
> Release some resources in the error handling path of the probe and of
> sun6i_mipi_csi2_resources_setup(), as already done in the remove
> function.

Thanks again, my comments are the same as in the other patch!

> Fixes: af54b4f4c17f ("media: sunxi: Add support for the A31 MIPI CSI-2 controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
> index a4e3f9a6b2ff..1ee8501e25f6 100644
> --- a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
> +++ b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
> @@ -661,7 +661,8 @@ sun6i_mipi_csi2_resources_setup(struct sun6i_mipi_csi2_device *csi2_dev,
> 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 err_put_clk_rate;
> }
>
> /* D-PHY */
> @@ -669,13 +670,14 @@ sun6i_mipi_csi2_resources_setup(struct sun6i_mipi_csi2_device *csi2_dev,
> csi2_dev->dphy = devm_phy_get(dev, "dphy");
> if (IS_ERR(csi2_dev->dphy)) {
> dev_err(dev, "failed to get MIPI D-PHY\n");
> - return PTR_ERR(csi2_dev->dphy);
> + ret = PTR_ERR(csi2_dev->dphy);
> + goto err_put_clk_rate;
> }
>
> ret = phy_init(csi2_dev->dphy);
> if (ret) {
> dev_err(dev, "failed to initialize MIPI D-PHY\n");
> - return ret;
> + goto err_put_clk_rate;
> }
>
> /* Runtime PM */
> @@ -683,6 +685,10 @@ sun6i_mipi_csi2_resources_setup(struct sun6i_mipi_csi2_device *csi2_dev,
> pm_runtime_enable(dev);
>
> return 0;
> +
> +err_put_clk_rate:

Please call this "error_clock_rate_exclusive",

> + clk_rate_exclusive_put(csi2_dev->clock_mod);

and add a blank line here.

> + return ret;
> }
>
> static void
> @@ -712,9 +718,13 @@ static int sun6i_mipi_csi2_probe(struct platform_device *platform_dev)
>
> ret = sun6i_mipi_csi2_bridge_setup(csi2_dev);
> if (ret)
> - return ret;
> + goto err_cleanup_resources;
>
> return 0;
> +
> +err_cleanup_resources:

Please call this "error_resources",

> + sun6i_mipi_csi2_resources_cleanup(csi2_dev);

and add a blank line here.

Thanks,

Paul

> + return ret;
> }
>
> static int sun6i_mipi_csi2_remove(struct platform_device *platform_dev)
> --
> 2.34.1
>

--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-08-05 16:12    [W:0.045 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site