[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9ebb9a5a-7bc8-da67-529f-5193b9352b23@infradead.org>
Date: Thu, 15 Jun 2023 15:40:01 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Arnd Bergmann <arnd@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc: Arnd Bergmann <arnd@...db.de>, Ben Levinsky <ben.levinsky@....com>,
Tanmay Shah <tanmay.shah@....com>,
Arnaud Pouliquen <arnaud.pouliquen@...s.st.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Dan Carpenter <dan.carpenter@...aro.org>,
linux-remoteproc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] remoteproc: stm32: use correct format strings on 64-bit
On 6/9/23 05:05, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> With CONFIG_ARCH_STM32 making it into arch/arm64, a couple of format
> strings no longer work, since they rely on size_t being compatible
> with %x, or they print an 'int' using %z:
>
> drivers/remoteproc/stm32_rproc.c: In function 'stm32_rproc_mem_alloc':
> drivers/remoteproc/stm32_rproc.c:122:22: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
> drivers/remoteproc/stm32_rproc.c:122:40: note: format string is defined here
> 122 | dev_dbg(dev, "map memory: %pa+%x\n", &mem->dma, mem->len);
> | ~^
> | |
> | unsigned int
> | %lx
> drivers/remoteproc/stm32_rproc.c:125:30: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
> drivers/remoteproc/stm32_rproc.c:125:65: note: format string is defined here
> 125 | dev_err(dev, "Unable to map memory region: %pa+%x\n",
> | ~^
> | |
> | unsigned int
> | %lx
> drivers/remoteproc/stm32_rproc.c: In function 'stm32_rproc_get_loaded_rsc_table':
> drivers/remoteproc/stm32_rproc.c:646:30: error: format '%zx' expects argument of type 'size_t', but argument 4 has type 'int' [-Werror=format=]
> drivers/remoteproc/stm32_rproc.c:646:66: note: format string is defined here
> 646 | dev_err(dev, "Unable to map memory region: %pa+%zx\n",
> | ~~^
> | |
> | long unsigned int
> | %x
>
> Fix up all three instances to work across architectures, and enable
> compile testing for this driver to ensure it builds everywhere.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Acked-by: Randy Dunlap <rdunlap@...radead.org>
Tested-by: Randy Dunlap <rdunlap@...radead.org> # build-tested
Thanks.
> ---
> drivers/remoteproc/Kconfig | 2 +-
> drivers/remoteproc/stm32_rproc.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index a850e9f486dd6..48845dc8fa852 100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
> @@ -313,7 +313,7 @@ config ST_SLIM_REMOTEPROC
>
> config STM32_RPROC
> tristate "STM32 remoteproc support"
> - depends on ARCH_STM32
> + depends on ARCH_STM32 || COMPILE_TEST
> depends on REMOTEPROC
> select MAILBOX
> help
> diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
> index a7457777aae43..cf073bac79f73 100644
> --- a/drivers/remoteproc/stm32_rproc.c
> +++ b/drivers/remoteproc/stm32_rproc.c
> @@ -119,10 +119,10 @@ static int stm32_rproc_mem_alloc(struct rproc *rproc,
> struct device *dev = rproc->dev.parent;
> void *va;
>
> - dev_dbg(dev, "map memory: %pa+%x\n", &mem->dma, mem->len);
> + dev_dbg(dev, "map memory: %pad+%zx\n", &mem->dma, mem->len);
> va = ioremap_wc(mem->dma, mem->len);
> if (IS_ERR_OR_NULL(va)) {
> - dev_err(dev, "Unable to map memory region: %pa+%x\n",
> + dev_err(dev, "Unable to map memory region: %pad+0x%zx\n",
> &mem->dma, mem->len);
> return -ENOMEM;
> }
> @@ -643,7 +643,7 @@ stm32_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)
>
> ddata->rsc_va = devm_ioremap_wc(dev, rsc_pa, RSC_TBL_SIZE);
> if (IS_ERR_OR_NULL(ddata->rsc_va)) {
> - dev_err(dev, "Unable to map memory region: %pa+%zx\n",
> + dev_err(dev, "Unable to map memory region: %pa+%x\n",
> &rsc_pa, RSC_TBL_SIZE);
> ddata->rsc_va = NULL;
> return ERR_PTR(-ENOMEM);
--
~Randy
Powered by blists - more mailing lists