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] [thread-next>] [day] [month] [year] [list]
Date: Thu, 25 Jan 2024 00:11:47 +0200
From: Iuliana Prodan <iuliana.prodan@....com>
To: Andrew Davis <afd@...com>, Bjorn Andersson <andersson@...nel.org>,
 Mathieu Poirier <mathieu.poirier@...aro.org>, Shawn Guo
 <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
 Pengutronix Kernel Team <kernel@...gutronix.de>,
 Fabio Estevam <festevam@...il.com>, NXP Linux Team <linux-imx@....com>,
 Konrad Dybcio <konrad.dybcio@...aro.org>,
 Patrice Chotard <patrice.chotard@...s.st.com>,
 Maxime Coquelin <mcoquelin.stm32@...il.com>,
 Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc: linux-remoteproc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc()
 helper

On 1/23/2024 8:46 PM, Andrew Davis wrote:
> Use the device lifecycle managed allocation function. This helps prevent
> mistakes like freeing out of order in cleanup functions and forgetting to
> free on error paths.
>
> Signed-off-by: Andrew Davis <afd@...com>

Reviewed-by: Iuliana Prodan <iuliana.prodan@....com>

Thanks,
Iulia

> ---
>   drivers/remoteproc/imx_dsp_rproc.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
> index a1c62d15f16c6..56a799cb8b363 100644
> --- a/drivers/remoteproc/imx_dsp_rproc.c
> +++ b/drivers/remoteproc/imx_dsp_rproc.c
> @@ -1104,8 +1104,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
>   		return ret;
>   	}
>   
> -	rproc = rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops, fw_name,
> -			    sizeof(*priv));
> +	rproc = devm_rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops,
> +				 fw_name, sizeof(*priv));
>   	if (!rproc)
>   		return -ENOMEM;
>   
> @@ -1125,14 +1125,14 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
>   	ret = imx_dsp_rproc_detect_mode(priv);
>   	if (ret) {
>   		dev_err(dev, "failed on imx_dsp_rproc_detect_mode\n");
> -		goto err_put_rproc;
> +		return ret;
>   	}
>   
>   	/* There are multiple power domains required by DSP on some platform */
>   	ret = imx_dsp_attach_pm_domains(priv);
>   	if (ret) {
>   		dev_err(dev, "failed on imx_dsp_attach_pm_domains\n");
> -		goto err_put_rproc;
> +		return ret;
>   	}
>   	/* Get clocks */
>   	ret = imx_dsp_rproc_clk_get(priv);
> @@ -1155,8 +1155,6 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
>   
>   err_detach_domains:
>   	imx_dsp_detach_pm_domains(priv);
> -err_put_rproc:
> -	rproc_free(rproc);
>   
>   	return ret;
>   }
> @@ -1169,7 +1167,6 @@ static void imx_dsp_rproc_remove(struct platform_device *pdev)
>   	pm_runtime_disable(&pdev->dev);
>   	rproc_del(rproc);
>   	imx_dsp_detach_pm_domains(priv);
> -	rproc_free(rproc);
>   }
>   
>   /* pm runtime functions */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ