From: sashiko-bot@kernel.org
To: "Mukesh Ojha" <mukesh.ojha@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v3 8/9] soc: qcom: mdt_loader: remove qcom_mdt_load()
Date: Tue, 17 Nov 2026 16:24:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-219167@kernel.org> (raw)
In-Reply-To: <20261116162148.2864501-9-mukesh.ojha@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] soc: qcom: mdt_loader: undocumented mapping change in
qcom_mdt_load_no_init()
--
commit eab28e4077f6ee900ea4fd6648711acdb8ef064c
Author: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
soc: qcom: mdt_loader: remove qcom_mdt_load()
This commit removes the unused qcom_mdt_load() wrapper and moves memory
mapping from qcom_mdt_pas_load() into qcom_mdt_load_no_init() when
mem_region is NULL.
> diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
> index aafa83466b92b..436d8bc4847a3 100644
> --- a/drivers/soc/qcom/mdt_loader.c
> +++ b/drivers/soc/qcom/mdt_loader.c
> @@ -326,7 +326,8 @@ static bool qcom_mdt_bins_are_split(const struct firmware *fw)
> * @dev: device handle to associate resources with
> * @fw: firmware object for the mdt file
> * @fw_name: name of the firmware, for construction of segment file names
> - * @mem_region: allocated memory region to load firmware into
> + * @mem_region: virtual address of the memory region to load firmware into,
> + * or NULL to have the region mapped internally with ioremap_wc()
> * @mem_phys: physical address of allocated memory region
> * @mem_size: size of the allocated memory region
> * @reloc_base: adjusted physical address after relocation
> @@ -341,6 +342,7 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
> const struct elf32_phdr *phdrs;
> const struct elf32_phdr *phdr;
> const struct elf32_hdr *ehdr;
> + void __iomem *mapped = NULL;
> phys_addr_t mem_reloc;
> phys_addr_t min_addr = PHYS_ADDR_MAX;
> ssize_t offset;
> @@ -350,12 +352,22 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
> int ret = 0;
> int i;
>
> - if (!fw || !mem_region || !mem_phys || !mem_size)
> + if (!fw || !mem_phys || !mem_size)
> return -EINVAL;
>
> if (!mdt_header_valid(fw))
> return -EINVAL;
>
> + if (!mem_region) {
> + mapped = ioremap_wc(mem_phys, mem_size);
> + if (!mapped) {
> + dev_err(dev, "unable to map memory region: %pa+%zx\n",
> + &mem_phys, mem_size);
> + return -ENOMEM;
> + }
> + mem_region = (__force void *)mapped;
> + }
> +
> is_split = qcom_mdt_bins_are_split(fw);
> ehdr = (struct elf32_hdr *)fw->data;
> phdrs = (struct elf32_phdr *)(fw->data + ehdr->e_phoff);
> @@ -434,39 +446,13 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
> if (reloc_base)
> *reloc_base = mem_reloc;
>
> + if (mapped)
> + iounmap(mapped);
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(qcom_mdt_load_no_init);
[ ... ]
> @@ -486,21 +472,14 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load);
> int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware *fw,
> const char *firmware, phys_addr_t *reloc_base)
> {
> - void __iomem *mem_region;
> int ret;
>
> ret = __qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id, ctx->mem_phys, ctx);
> if (ret)
> return ret;
>
> - mem_region = qcom_pas_ctx_map(ctx);
> - if (!mem_region)
> - return -ENOMEM;
> -
> - ret = qcom_mdt_load_no_init(ctx->dev, fw, firmware, (__force void *)mem_region,
> - ctx->mem_phys, ctx->mem_size, reloc_base);
> - iounmap(mem_region);
> - return ret;
> + return qcom_mdt_load_no_init(ctx->dev, fw, firmware, NULL,
> + ctx->mem_phys, ctx->mem_size, reloc_base);
> }
[Severity: Medium]
Why does this patch move the memory mapping from qcom_mdt_pas_load() into
qcom_mdt_load_no_init()?
The changelog only describes removing qcom_mdt_load(), which was already a
simple wrapper around __qcom_mdt_pas_init() and qcom_mdt_load_no_init().
Moving the mapping into qcom_mdt_load_no_init() duplicates the ioremap_wc()
and error logging already provided by qcom_pas_ctx_map():
include/linux/firmware/qcom/qcom_pas.h:qcom_pas_ctx_map() {
void __iomem *ptr = ioremap_wc(ctx->mem_phys, ctx->mem_size);
if (!ptr)
dev_err(ctx->dev, "unable to map memory region: %pa+%zx\n",
&ctx->mem_phys, ctx->mem_size);
return ptr;
}
All direct callers of qcom_mdt_load_no_init() manage their own mem_region
mapping. Dropping the !mem_region check means a non-PAS caller that
inadvertently passes a NULL mem_region after a mapping failure will
silently trigger an internal ioremap_wc() instead of failing with -EINVAL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116162148.2864501-1-mukesh.ojha@oss.qualcomm.com?part=8
next prev parent reply other threads:[~2026-11-17 16:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:21 [PATCH v3 0/9] Migrate PAS clients to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset() Mukesh Ojha
2026-11-16 16:21 ` [PATCH v3 1/9] firmware: qcom: pas: add qcom_pas_context_init() for pre-allocated context Mukesh Ojha
2026-11-16 16:21 ` [PATCH v3 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset() Mukesh Ojha
2026-11-16 16:21 ` [PATCH v3 3/9] drm/msm/adreno: migrate zap shader loading " Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot
2026-11-16 16:21 ` [PATCH v3 4/9] media: iris: migrate firmware " Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot
2026-11-16 16:21 ` [PATCH v3 5/9] media: venus: " Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot
2026-11-16 16:21 ` [PATCH v3 6/9] net: ipa: " Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot
2026-11-16 16:21 ` [PATCH v3 7/9] wifi: ath12k: " Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot
2026-11-16 16:21 ` [PATCH v3 8/9] soc: qcom: mdt_loader: remove qcom_mdt_load() Mukesh Ojha
2026-11-17 16:24 ` sashiko-bot [this message]
2026-11-16 16:21 ` [PATCH v3 9/9] firmware: qcom: pas: remove qcom_pas_auth_and_reset() 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=sashiko-outbox-219167@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=mukesh.ojha@oss.qualcomm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.