linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Andrew Davis <afd@ti.com>
Cc: Jai Luthra <j-luthra@ti.com>, Hari Nagalla <hnagalla@ti.com>,
	Bjorn Andersson <andersson@kernel.org>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper
Date: Fri, 2 Feb 2024 11:21:51 -0700	[thread overview]
Message-ID: <Zb0yv9Zr8DQfAqXs@p14s> (raw)
In-Reply-To: <20240123184913.725435-4-afd@ti.com>

Hi Andrew,

On Tue, Jan 23, 2024 at 12:49:09PM -0600, Andrew Davis wrote:
> Use the device lifecycle managed TI-SCI get() function. This helps prevent
> mistakes like not put()'ing in the wrong order in cleanup functions and
> forgetting to put() on error paths.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 33 +++++++----------------
>  1 file changed, 9 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> index a13552c71f440..0240340a83e90 100644
> --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> @@ -682,7 +682,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
>  	const char *fw_name;
>  	bool p_state = false;
>  	int ret = 0;
> -	int ret1;
> 

This patch is giving me a compilation error because @ret1 is still used in
"release_tsp:".  The 3rd hunk in the next patch is showing the problem.  The
goto statement is removed in the 6th patch.

I have applied the first 3 patches of this set so no need to resend them with
the next revision.  And please add a cover letter next time.

Thanks,
Mathieu

>  	data = of_device_get_match_data(dev);
>  	if (!data)
> @@ -708,30 +707,24 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
>  	kproc->dev = dev;
>  	kproc->data = data;
>  
> -	kproc->ti_sci = ti_sci_get_by_phandle(np, "ti,sci");
> +	kproc->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
>  	if (IS_ERR(kproc->ti_sci))
>  		return dev_err_probe(dev, PTR_ERR(kproc->ti_sci),
>  				     "failed to get ti-sci handle\n");
>  
>  	ret = of_property_read_u32(np, "ti,sci-dev-id", &kproc->ti_sci_id);
> -	if (ret) {
> -		dev_err_probe(dev, ret, "missing 'ti,sci-dev-id' property\n");
> -		goto put_sci;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "missing 'ti,sci-dev-id' property\n");
>  
>  	kproc->reset = devm_reset_control_get_exclusive(dev, NULL);
> -	if (IS_ERR(kproc->reset)) {
> -		ret = dev_err_probe(dev, PTR_ERR(kproc->reset),
> -				    "failed to get reset\n");
> -		goto put_sci;
> -	}
> +	if (IS_ERR(kproc->reset))
> +		return dev_err_probe(dev, PTR_ERR(kproc->reset),
> +				     "failed to get reset\n");
>  
>  	kproc->tsp = k3_dsp_rproc_of_get_tsp(dev, kproc->ti_sci);
> -	if (IS_ERR(kproc->tsp)) {
> -		ret = dev_err_probe(dev, PTR_ERR(kproc->tsp),
> -				    "failed to construct ti-sci proc control\n");
> -		goto put_sci;
> -	}
> +	if (IS_ERR(kproc->tsp))
> +		return dev_err_probe(dev, PTR_ERR(kproc->tsp),
> +				     "failed to construct ti-sci proc control\n");
>  
>  	ret = ti_sci_proc_request(kproc->tsp);
>  	if (ret < 0) {
> @@ -805,10 +798,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
>  		dev_err(dev, "failed to release proc (%pe)\n", ERR_PTR(ret1));
>  free_tsp:
>  	kfree(kproc->tsp);
> -put_sci:
> -	ret1 = ti_sci_put_handle(kproc->ti_sci);
> -	if (ret1)
> -		dev_err(dev, "failed to put ti_sci handle (%pe)\n", ERR_PTR(ret1));
>  	return ret;
>  }
>  
> @@ -836,10 +825,6 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev)
>  
>  	kfree(kproc->tsp);
>  
> -	ret = ti_sci_put_handle(kproc->ti_sci);
> -	if (ret)
> -		dev_err(dev, "failed to put ti_sci handle (%pe)\n", ERR_PTR(ret));
> -
>  	k3_dsp_reserved_mem_exit(kproc);
>  }
>  
> -- 
> 2.39.2
> 

  reply	other threads:[~2024-02-02 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 18:49 [PATCH 1/8] remoteproc: k3-dsp: Use devm_rproc_alloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 2/8] remoteproc: k3-dsp: Add devm action to release reserved memory Andrew Davis
2024-01-23 18:49 ` [PATCH 3/8] remoteproc: k3-dsp: Use devm_kcalloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 4/8] remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper Andrew Davis
2024-02-02 18:21   ` Mathieu Poirier [this message]
2024-01-23 18:49 ` [PATCH 5/8] remoteproc: k3-dsp: Use devm_kzalloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 6/8] remoteproc: k3-dsp: Add devm action to release tsp Andrew Davis
2024-01-23 18:49 ` [PATCH 7/8] remoteproc: k3-dsp: Use devm_ioremap_wc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 8/8] remoteproc: k3-dsp: Use devm_rproc_add() helper Andrew Davis

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=Zb0yv9Zr8DQfAqXs@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=afd@ti.com \
    --cc=andersson@kernel.org \
    --cc=hnagalla@ti.com \
    --cc=j-luthra@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).