generic: platform/mikrotik: fix routerboot_tag_show_u32s()

The routine would only accurately print out the first word.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Fixes: 5ecf7d96 ("generic: routerboot sysfs platform driver")
master
Thibaut VARÈNE 2020-06-05 13:59:41 +02:00 committed by Petr Štetiar
parent 8c13ebd3ad
commit 5c4b431a3c
1 changed files with 5 additions and 5 deletions

View File

@ -194,18 +194,18 @@ ssize_t routerboot_tag_show_string(const u8 *pld, u16 pld_len, char *buf)
ssize_t routerboot_tag_show_u32s(const u8 *pld, u16 pld_len, char *buf) ssize_t routerboot_tag_show_u32s(const u8 *pld, u16 pld_len, char *buf)
{ {
char *out = buf; char *out = buf;
u32 data; // cpu-endian u32 *data; // cpu-endian
/* Caller ensures pld_len > 0 */ /* Caller ensures pld_len > 0 */
if (pld_len % sizeof(data)) if (pld_len % sizeof(*data))
return -EINVAL; return -EINVAL;
data = *(u32 *)pld; data = (u32 *)pld;
do { do {
out += sprintf(out, "0x%08x\n", data); out += sprintf(out, "0x%08x\n", *data);
data++; data++;
} while ((pld_len -= sizeof(data))); } while ((pld_len -= sizeof(*data)));
return out - buf; return out - buf;
} }