Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH V2] memory: tegra186-emc: Fix missing put_bpmp
@ 2025-11-06 17:32 Jon Hunter
  2025-11-06 18:35 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Hunter @ 2025-11-06 17:32 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Thierry Reding; +Cc: linux-tegra, Jon Hunter

Commit a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred
probe with dev_err_probe()") accidently dropped a call to 'put_bpmp' to
release a handle to the BPMP when getting the EMC clock fails. Fix this
by restoring the 'goto put_bpmp' if devm_clk_get() fails.

Fixes: a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred probe with dev_err_probe()")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
Changes since V1:
- Fixed dev_err_probe message format

Please note that the commit hash reference is based upon the hash in
the -next tree.

 drivers/memory/tegra/tegra186-emc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c
index 74be09968baa..43595fd9c256 100644
--- a/drivers/memory/tegra/tegra186-emc.c
+++ b/drivers/memory/tegra/tegra186-emc.c
@@ -448,9 +448,11 @@ static int tegra186_emc_probe(struct platform_device *pdev)
 				     "failed to get BPMP\n");
 
 	emc->clk = devm_clk_get(&pdev->dev, "emc");
-	if (IS_ERR(emc->clk))
-		return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
-				     "failed to get EMC clock\n");
+	if (IS_ERR(emc->clk)) {
+		err = PTR_ERR(emc->clk);
+		dev_err_probe(&pdev->dev, err, "failed to get EMC clock\n");
+		goto put_bpmp;
+	}
 
 	platform_set_drvdata(pdev, emc);
 	emc->dev = &pdev->dev;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] memory: tegra186-emc: Fix missing put_bpmp
  2025-11-06 17:32 [PATCH V2] memory: tegra186-emc: Fix missing put_bpmp Jon Hunter
@ 2025-11-06 18:35 ` Krzysztof Kozlowski
  2025-11-06 19:03   ` Jon Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-06 18:35 UTC (permalink / raw)
  To: Jon Hunter, Thierry Reding; +Cc: linux-tegra

On 06/11/2025 18:32, Jon Hunter wrote:
> Commit a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred
> probe with dev_err_probe()") accidently dropped a call to 'put_bpmp' to
> release a handle to the BPMP when getting the EMC clock fails. Fix this
> by restoring the 'goto put_bpmp' if devm_clk_get() fails.
> 
> Fixes: a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred probe with dev_err_probe()")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> Changes since V1:
> - Fixed dev_err_probe message format
> 
> Please note that the commit hash reference is based upon the hash in
> the -next tree.
> 
>  drivers/memory/tegra/tegra186-emc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c
> index 74be09968baa..43595fd9c256 100644
> --- a/drivers/memory/tegra/tegra186-emc.c
> +++ b/drivers/memory/tegra/tegra186-emc.c
> @@ -448,9 +448,11 @@ static int tegra186_emc_probe(struct platform_device *pdev)
>  				     "failed to get BPMP\n");
>  
>  	emc->clk = devm_clk_get(&pdev->dev, "emc");
> -	if (IS_ERR(emc->clk))
> -		return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
> -				     "failed to get EMC clock\n");
> +	if (IS_ERR(emc->clk)) {
> +		err = PTR_ERR(emc->clk);
> +		dev_err_probe(&pdev->dev, err, "failed to get EMC clock\n");

This still should use standard dev_err_probe syntax, so:

err = dev_err_probe(..., PTR_ERR(), "....");

which saves you one line with earlier assignment.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] memory: tegra186-emc: Fix missing put_bpmp
  2025-11-06 18:35 ` Krzysztof Kozlowski
@ 2025-11-06 19:03   ` Jon Hunter
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2025-11-06 19:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Thierry Reding; +Cc: linux-tegra


On 06/11/2025 18:35, Krzysztof Kozlowski wrote:
> On 06/11/2025 18:32, Jon Hunter wrote:
>> Commit a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred
>> probe with dev_err_probe()") accidently dropped a call to 'put_bpmp' to
>> release a handle to the BPMP when getting the EMC clock fails. Fix this
>> by restoring the 'goto put_bpmp' if devm_clk_get() fails.
>>
>> Fixes: a52ddb98a674 ("memory: tegra186-emc: Simplify and handle deferred probe with dev_err_probe()")
>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
>> ---
>> Changes since V1:
>> - Fixed dev_err_probe message format
>>
>> Please note that the commit hash reference is based upon the hash in
>> the -next tree.
>>
>>   drivers/memory/tegra/tegra186-emc.c | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c
>> index 74be09968baa..43595fd9c256 100644
>> --- a/drivers/memory/tegra/tegra186-emc.c
>> +++ b/drivers/memory/tegra/tegra186-emc.c
>> @@ -448,9 +448,11 @@ static int tegra186_emc_probe(struct platform_device *pdev)
>>   				     "failed to get BPMP\n");
>>   
>>   	emc->clk = devm_clk_get(&pdev->dev, "emc");
>> -	if (IS_ERR(emc->clk))
>> -		return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
>> -				     "failed to get EMC clock\n");
>> +	if (IS_ERR(emc->clk)) {
>> +		err = PTR_ERR(emc->clk);
>> +		dev_err_probe(&pdev->dev, err, "failed to get EMC clock\n");
> 
> This still should use standard dev_err_probe syntax, so:
> 
> err = dev_err_probe(..., PTR_ERR(), "....");
> 
> which saves you one line with earlier assignment.

Yes that is indeed better!

Jon

-- 
nvpublic


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-06 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06 17:32 [PATCH V2] memory: tegra186-emc: Fix missing put_bpmp Jon Hunter
2025-11-06 18:35 ` Krzysztof Kozlowski
2025-11-06 19:03   ` Jon Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox