lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YwTFApDoY0c/LH45@aptenodytes>
Date:   Tue, 23 Aug 2022 14:16:02 +0200
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Samuel Holland <samuel@...lland.org>,
        Maxime Ripard <mripard@...nel.org>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH v2 2/2] media: sunxi: Fix some error handling path of
 sun6i_mipi_csi2_probe()

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
> sun6i_mipi_csi2_resources_setup(), as already done in the remove
> function.

Looks good to me, thanks!

Acked-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>

Cheers,

Paul
 
> Fixes: af54b4f4c17f ("media: sunxi: Add support for the A31 MIPI CSI-2 controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Changes in v2:
>   * add some blank line   [Paul Kocialkowski <paul.kocialkowski@...tlin.com>]
>   * rename the new labels   [Paul Kocialkowski <paul.kocialkowski@...tlin.com>]
> 
> v1:
>   https://lore.kernel.org/all/9999a30560d0ab8201734cbab0483c6f840402da.1659295329.git.christophe.jaillet@wanadoo.fr/
> ---
>  .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c   | 20 +++++++++++++++----
>  1 file changed, 16 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..30d6c0c5161f 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 error_clock_rate_exclusive;
>  	}
>  
>  	/* 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 error_clock_rate_exclusive;
>  	}
>  
>  	ret = phy_init(csi2_dev->dphy);
>  	if (ret) {
>  		dev_err(dev, "failed to initialize MIPI D-PHY\n");
> -		return ret;
> +		goto error_clock_rate_exclusive;
>  	}
>  
>  	/* Runtime PM */
> @@ -683,6 +685,11 @@ sun6i_mipi_csi2_resources_setup(struct sun6i_mipi_csi2_device *csi2_dev,
>  	pm_runtime_enable(dev);
>  
>  	return 0;
> +
> +error_clock_rate_exclusive:
> +	clk_rate_exclusive_put(csi2_dev->clock_mod);
> +
> +	return ret;
>  }
>  
>  static void
> @@ -712,9 +719,14 @@ static int sun6i_mipi_csi2_probe(struct platform_device *platform_dev)
>  
>  	ret = sun6i_mipi_csi2_bridge_setup(csi2_dev);
>  	if (ret)
> -		return ret;
> +		goto error_resources;
>  
>  	return 0;
> +
> +error_resources:
> +	sun6i_mipi_csi2_resources_cleanup(csi2_dev);
> +
> +	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

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ