Skip to contentSkip to conversation

drivers: iommu: fix clang -wformat warning

PATCH Applied Justin Stitt 3 participants 3 messages Jul 21, 2022 – Jul 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
Reported by Nathan here:
https://lore.kernel.org/all/[email protected]/

 drivers/iommu/msm_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/msm_iommu.c +1 -1
index 428919a474c1..6a24aa804ea3 100644
@@ -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;
 		}
Signature · 1 line
2.37.1.359.gd136c6c3e2-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Justin Stitt

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.

Thanks for the patch!

Quoted 24 lines

---
Reported by Nathan here:
https://lore.kernel.org/all/[email protected]/

 drivers/iommu/msm_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/msm_iommu.c +1 -1
index 428919a474c1..6a24aa804ea3 100644
@@ -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;
 		}
Signature · 1 line
2.37.1.359.gd136c6c3e2-goog