aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorThibaut VARÈNE <hacks@slashdirt.org>2020-06-05 13:59:41 +0200
committerPetr Štetiar <ynezz@true.cz>2020-07-08 16:07:05 +0200
commit5c4b431a3cd00bd0e7d0d66abe5ff02d669a9266 (patch)
tree6215dbf92c0107976c8279dbbff24c0f61ddeca3 /target/linux/generic/files
parent8c13ebd3ad7532fce916d1160e1218a6a40f50b1 (diff)
downloadupstream-5c4b431a3cd00bd0e7d0d66abe5ff02d669a9266.tar.gz
upstream-5c4b431a3cd00bd0e7d0d66abe5ff02d669a9266.tar.bz2
upstream-5c4b431a3cd00bd0e7d0d66abe5ff02d669a9266.zip
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")
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/drivers/platform/mikrotik/routerboot.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c
index 47e4471f8e..4c8c0bfac5 100644
--- a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c
+++ b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c
@@ -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)
{
char *out = buf;
- u32 data; // cpu-endian
+ u32 *data; // cpu-endian
/* Caller ensures pld_len > 0 */
- if (pld_len % sizeof(data))
+ if (pld_len % sizeof(*data))
return -EINVAL;
- data = *(u32 *)pld;
+ data = (u32 *)pld;
do {
- out += sprintf(out, "0x%08x\n", data);
+ out += sprintf(out, "0x%08x\n", *data);
data++;
- } while ((pld_len -= sizeof(data)));
+ } while ((pld_len -= sizeof(*data)));
return out - buf;
}