Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mukesh Ojha" <mukesh.ojha@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 04/19] firmware: qcom: scm: use dev_err_probe() for dload address failure
Date: Wed, 24 Jun 2026 19:22:13 +0000	[thread overview]
Message-ID: <20260624192213.C82691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624190830.3131112-5-mukesh.ojha@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] The global `qcom_tzmem_dev` pointer is set during `qcom_tzmem_enable()` but is never cleared on probe failure, causing subsequent probe retries to permanently fail with `-EBUSY`.
- [High] The probe function calls `of_reserved_mem_device_init()` but does not call `of_reserved_mem_device_release()` on subsequent error paths, leading to permanent probe failure or resource leaks upon probe retry.
--

commit 6dc15526252b78a9c217f06ed35ed4966a794450
Author: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>

firmware: qcom: scm: use dev_err_probe() for dload address failure

Replace the bare return ret after qcom_scm_find_dload_address() with
dev_err_probe() to produce a consistent, deferred-probe-aware error
message when the download-mode address cannot be resolved.

> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index c8a84836887f0..6cd4d9468456f 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -2750,7 +2750,8 @@ static int qcom_scm_probe(struct platform_device *pdev)
>  	scm->dev = &pdev->dev;
>  	ret = qcom_scm_find_dload_address(&pdev->dev, &scm->dload_mode_addr);
>  	if (ret < 0)
> -		return ret;
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "Failed to get download mode address\n");
>  
>  	mutex_init(&scm->scm_bw_lock);

[Severity: High]
This is a pre-existing issue, but does qcom_scm_probe() properly release
resources on later probe failures?

Later in qcom_scm_probe(), of_reserved_mem_device_init() is called to setup
reserved memory:

drivers/firmware/qcom/qcom_scm.c:qcom_scm_probe() {
	...
	ret = of_reserved_mem_device_init(scm->dev);
	if (ret && ret != -ENODEV)
		return dev_err_probe(scm->dev, ret,
				     "Failed to setup the reserved memory region for TZ mem\n");
	...
}

However, subsequent error paths, such as platform_get_irq_optional() returning
-EPROBE_DEFER, exit directly without calling of_reserved_mem_device_release().

If the probe is deferred, will this cause the next probe attempt to fail with
-EBUSY, or leak memory by duplicating the rmem_assigned_device list entry on
every retry?

[Severity: High]
This is a pre-existing issue, but does qcom_tzmem_enable() cause a permanent
probe failure if qcom_scm_probe() defers later in the function?

qcom_tzmem_enable() sets a static qcom_tzmem_dev pointer in qcom_tzmem.c:

drivers/firmware/qcom/qcom_tzmem.c:qcom_tzmem_enable() {
	if (qcom_tzmem_dev)
		return -EBUSY;

	qcom_tzmem_dev = dev;

	return qcom_tzmem_init();
}

Since qcom_scm_probe() does not clear this pointer if it defers after this
call, will subsequent probe retries permanently fail with -EBUSY when
qcom_tzmem_enable() checks the still-set pointer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260624190830.3131112-1-mukesh.ojha@oss.qualcomm.com?part=4

  reply	other threads:[~2026-06-24 19:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 19:08 [PATCH v4 00/19] firmware: qcom: scm: Add minidump SRAM destination support Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 01/19] dt-bindings: firmware: qcom,scm: Add minidump SRAM property Mukesh Ojha
2026-06-24 19:19   ` sashiko-bot
2026-06-24 19:08 ` [PATCH v4 02/19] dt-bindings: sram: qcom,imem: Add minidump-sram pattern property Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 03/19] firmware: qcom: scm: Fix missing smp_load_acquire() Mukesh Ojha
2026-06-24 19:24   ` sashiko-bot
2026-06-24 19:08 ` [PATCH v4 04/19] firmware: qcom: scm: use dev_err_probe() for dload address failure Mukesh Ojha
2026-06-24 19:22   ` sashiko-bot [this message]
2026-06-24 19:08 ` [PATCH v4 05/19] firmware: qcom: scm: Add minidump SRAM support Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 06/19] arm64: dts: qcom: kaanapali: Add minidump SRAM config to SCM node Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 07/19] arm64: dts: qcom: sm8450: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 08/19] arm64: dts: qcom: sa8775p: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 09/19] arm64: dts: qcom: qcs8300: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 10/19] arm64: dts: qcom: qdu1000: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 11/19] arm64: dts: qcom: sm8550: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 12/19] arm64: dts: qcom: sm8650: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 13/19] arm64: dts: qcom: sc7280: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 14/19] arm64: dts: qcom: sm8350: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 15/19] arm64: dts: qcom: sc7180: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 16/19] arm64: dts: qcom: sm6350: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 17/19] arm64: dts: qcom: sm6375: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 18/19] arm64: dts: qcom: qcs615: " Mukesh Ojha
2026-06-24 19:08 ` [PATCH v4 19/19] arm64: dts: qcom: sdm845: " Mukesh Ojha

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=20260624192213.C82691F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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