2022-07-21 21:08:09

by Justin Stitt

[permalink] [raw]
Subject: [PATCH] drivers: iommu: fix clang -wformat warning

When building with Clang we encounter the following warning:
| drivers/iommu/msm_iommu.c:603:6: error: format specifies type 'unsigned
| short' but the argument has type 'int' [-Werror,-Wformat] sid);

`sid` is an int, use the proper format specifier `%x`.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Reported-by: Nathan Chancellor <[email protected]>
Suggested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Justin Stitt <[email protected]>
---
Reported by Nathan here:
https://lore.kernel.org/all/[email protected]/

drivers/iommu/msm_iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 428919a474c1..6a24aa804ea3 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -599,7 +599,7 @@ static int insert_iommu_master(struct device *dev,

for (sid = 0; sid < master->num_mids; sid++)
if (master->mids[sid] == spec->args[0]) {
- dev_warn(dev, "Stream ID 0x%hx repeated; ignoring\n",
+ dev_warn(dev, "Stream ID 0x%x repeated; ignoring\n",
sid);
return 0;
}
--
2.37.1.359.gd136c6c3e2-goog


2022-07-21 22:11:35

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] drivers: iommu: fix clang -wformat warning

On Thu, Jul 21, 2022 at 02:03:31PM -0700, Justin Stitt wrote:
> When building with Clang we encounter the following warning:
> | drivers/iommu/msm_iommu.c:603:6: error: format specifies type 'unsigned
> | short' but the argument has type 'int' [-Werror,-Wformat] sid);
>
> `sid` is an int, use the proper format specifier `%x`.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Reported-by: Nathan Chancellor <[email protected]>
> Suggested-by: Nathan Chancellor <[email protected]>
> Signed-off-by: Justin Stitt <[email protected]>

Thanks for the patch!

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
> Reported by Nathan here:
> https://lore.kernel.org/all/[email protected]/
>
> drivers/iommu/msm_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
> index 428919a474c1..6a24aa804ea3 100644
> --- a/drivers/iommu/msm_iommu.c
> +++ b/drivers/iommu/msm_iommu.c
> @@ -599,7 +599,7 @@ static int insert_iommu_master(struct device *dev,
>
> for (sid = 0; sid < master->num_mids; sid++)
> if (master->mids[sid] == spec->args[0]) {
> - dev_warn(dev, "Stream ID 0x%hx repeated; ignoring\n",
> + dev_warn(dev, "Stream ID 0x%x repeated; ignoring\n",
> sid);
> return 0;
> }
> --
> 2.37.1.359.gd136c6c3e2-goog
>
>

2022-07-22 14:54:24

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH] drivers: iommu: fix clang -wformat warning

On Thu, Jul 21, 2022 at 02:03:31PM -0700, Justin Stitt wrote:
> drivers/iommu/msm_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.