[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH] dmidecode: Fix format warnings
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH] dmidecode: Fix format warnings |
Date: |
Tue, 12 Jan 2021 15:16:14 +0100 |
Use the appropriate format specifiers to make the compiler happy.
This fixes support ticket #110421:
https://savannah.nongnu.org/support/index.php?110421
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 14 +++++++-------
dmioem.c | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2174,7 +2174,7 @@ static void dmi_slot_peers(u8 n, const u
for (i = 1; i <= n; i++, data += 5)
{
- sprintf(attr, "Peer Device %hu", i);
+ sprintf(attr, "Peer Device %hhu", (u8)i);
pr_attr(attr, "%04x:%02x:%02x.%x (Width %u)",
WORD(data), data[2], data[3] >> 3, data[3] & 0x07,
data[4]);
@@ -2240,7 +2240,7 @@ static void dmi_oem_strings(const struct
for (i = 1; i <= count; i++)
{
- sprintf(attr, "String %hu", i);
+ sprintf(attr, "String %hhu", (u8)i);
pr_attr(attr, "%s",dmi_string(h, i));
}
}
@@ -2258,7 +2258,7 @@ static void dmi_system_configuration_opt
for (i = 1; i <= count; i++)
{
- sprintf(attr, "Option %hu", i);
+ sprintf(attr, "Option %hhu", (u8)i);
pr_attr(attr, "%s",dmi_string(h, i));
}
}
@@ -2442,10 +2442,10 @@ static void dmi_event_log_descriptors(u8
{
if (len >= 0x02)
{
- sprintf(attr, "Descriptor %hu", i + 1);
+ sprintf(attr, "Descriptor %d", i + 1);
pr_attr(attr, "%s",
dmi_event_log_descriptor_type(p[i * len]));
- sprintf(attr, "Data Format %hu", i + 1);
+ sprintf(attr, "Data Format %d", i + 1);
pr_attr(attr, "%s",
dmi_event_log_descriptor_format(p[i * len +
1]));
}
@@ -3423,11 +3423,11 @@ static void dmi_memory_channel_devices(u
for (i = 1; i <= count; i++)
{
- sprintf(attr, "Device %hu Load", i);
+ sprintf(attr, "Device %hhu Load", (u8)i);
pr_attr(attr, "%u", p[3 * i]);
if (!(opt.flags & FLAG_QUIET))
{
- sprintf(attr, "Device %hu Handle", i);
+ sprintf(attr, "Device %hhu Handle", (u8)i);
pr_attr(attr, "0x%04X", WORD(p + 3 * i + 1));
}
}
--- a/dmioem.c
+++ b/dmioem.c
@@ -146,7 +146,7 @@ static void dmi_print_hp_net_iface_rec(u
if (id == 0xFF)
id = ++nic_ctr;
- sprintf(attr, "NIC %hu", id);
+ sprintf(attr, "NIC %hhu", id);
if (dev == 0x00 && bus == 0x00)
pr_attr(attr, "Disabled");
else if (dev == 0xFF && bus == 0xFF)
--
Jean Delvare
SUSE L3 Support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dmidecode] [PATCH] dmidecode: Fix format warnings,
Jean Delvare <=