[PATCH 06/11] soc: ti: knav_qmss: Fix __iomem annotations and __be32 type

Andrew Davis afd at ti.com
Fri May 8 10:14:17 PDT 2026


On 5/8/26 10:32 AM, Nishanth Menon wrote:
> Fix several address-space and type annotation issues reported by sparse:
> 
> - Fix knav_queue_pdsp_wait() declaration: correct the parameter
>    annotation from 'u32 * __iomem' (pointer-in-iomem-space) to
>    'u32 __iomem *' (pointer-to-iomem); use 'unsigned int' for the
>    timeout parameter instead of bare 'unsigned'; fix the continuation-
>    line alignment. Cast the void __iomem * argument at the call site
>    that passes pdsp->command.
> - Use IOMEM_ERR_PTR() in knav_queue_map_reg() instead of ERR_PTR() when
>    returning an error as void __iomem * to avoid 'different address
>    spaces' warnings.
> - Annotate the firmware data array as 'const __be32 *' instead of
>    'u32 *', as be32_to_cpu() requires __be32 input.
> 
> Signed-off-by: Nishanth Menon <nm at ti.com>
> ---
>   drivers/soc/ti/knav_qmss_queue.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
> index 50072e9dea37..412b91344d20 100644
> --- a/drivers/soc/ti/knav_qmss_queue.c
> +++ b/drivers/soc/ti/knav_qmss_queue.c
> @@ -477,8 +477,8 @@ static int knav_queue_debug_show(struct seq_file *s, void *v)
>   
>   DEFINE_SHOW_ATTRIBUTE(knav_queue_debug);
>   
> -static inline int knav_queue_pdsp_wait(u32 * __iomem addr, unsigned timeout,
> -					u32 flags)
> +static inline int knav_queue_pdsp_wait(u32 __iomem *addr, unsigned int timeout,
> +				       u32 flags)
>   {
>   	unsigned long end;
>   	u32 val = 0;
> @@ -1368,7 +1368,7 @@ static void __iomem *knav_queue_map_reg(struct knav_device *kdev,
>   	if (ret) {
>   		dev_err(kdev->dev, "Can't translate of node(%pOFn) address for index(%d)\n",
>   			node, index);
> -		return ERR_PTR(ret);
> +		return IOMEM_ERR_PTR(ret);
>   	}
>   
>   	regs = devm_ioremap_resource(kdev->dev, &res);
> @@ -1556,7 +1556,7 @@ static int knav_queue_load_pdsp(struct knav_device *kdev,
>   	int i, ret, fwlen;
>   	const struct firmware *fw;
>   	bool found = false;
> -	u32 *fwdata;
> +	const __be32 *fwdata;
>   
>   	for (i = 0; i < ARRAY_SIZE(knav_acc_firmwares); i++) {
>   		if (knav_acc_firmwares[i]) {
> @@ -1580,7 +1580,7 @@ static int knav_queue_load_pdsp(struct knav_device *kdev,
>   
>   	writel_relaxed(pdsp->id + 1, pdsp->command + 0x18);
>   	/* download the firmware */
> -	fwdata = (u32 *)fw->data;
> +	fwdata = (const __be32 *)fw->data;
>   	fwlen = (fw->size + sizeof(u32) - 1) / sizeof(u32);
>   	for (i = 0; i < fwlen; i++)
>   		writel_relaxed(be32_to_cpu(fwdata[i]), pdsp->iram + i);
> @@ -1610,7 +1610,7 @@ static int knav_queue_start_pdsp(struct knav_device *kdev,
>   	writel_relaxed(val, &pdsp->regs->control);
>   
>   	/* wait for command register to clear */
> -	ret = knav_queue_pdsp_wait(pdsp->command, timeout, 0);
> +	ret = knav_queue_pdsp_wait((u32 __iomem *)pdsp->command, timeout, 0);

Why not make `command`'s type `u32 __iomem *` instead of casting it when used?

Andrew

>   	if (ret < 0) {
>   		dev_err(kdev->dev,
>   			"timed out on pdsp %s command register wait\n",




More information about the linux-arm-kernel mailing list