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]
Message-ID: <a917a6f4-eb54-4ce9-b893-38b3d3178138@nxp.com>
Date: Thu, 25 Jan 2024 00:12:29 +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 2/9] remoteproc: imx_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_rproc.c | 16 +++++-----------
>   1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 8bb293b9f327c..55ecce3ab5f75 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -1104,16 +1104,14 @@ static int imx_rproc_probe(struct platform_device *pdev)
>   	int ret;
>   
>   	/* set some other name then imx */
> -	rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops,
> -			    NULL, sizeof(*priv));
> +	rproc = devm_rproc_alloc(dev, "imx-rproc", &imx_rproc_ops,
> +				 NULL, sizeof(*priv));
>   	if (!rproc)
>   		return -ENOMEM;
>   
>   	dcfg = of_device_get_match_data(dev);
> -	if (!dcfg) {
> -		ret = -EINVAL;
> -		goto err_put_rproc;
> -	}
> +	if (!dcfg)
> +		return -EINVAL;
>   
>   	priv = rproc->priv;
>   	priv->rproc = rproc;
> @@ -1124,8 +1122,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
>   	priv->workqueue = create_workqueue(dev_name(dev));
>   	if (!priv->workqueue) {
>   		dev_err(dev, "cannot create workqueue\n");
> -		ret = -ENOMEM;
> -		goto err_put_rproc;
> +		return -ENOMEM;
>   	}
>   
>   	ret = imx_rproc_xtr_mbox_init(rproc);
> @@ -1167,8 +1164,6 @@ static int imx_rproc_probe(struct platform_device *pdev)
>   	imx_rproc_free_mbox(rproc);
>   err_put_wkq:
>   	destroy_workqueue(priv->workqueue);
> -err_put_rproc:
> -	rproc_free(rproc);
>   
>   	return ret;
>   }
> @@ -1183,7 +1178,6 @@ static void imx_rproc_remove(struct platform_device *pdev)
>   	imx_rproc_put_scu(rproc);
>   	imx_rproc_free_mbox(rproc);
>   	destroy_workqueue(priv->workqueue);
> -	rproc_free(rproc);
>   }
>   
>   static const struct of_device_id imx_rproc_of_match[] = {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ