summaryrefslogtreecommitdiffstats
path: root/drivers/of/module.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 21:00:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 21:00:51 +0000
commit6d03a247468059b0e59c821ef39e6762d4d6fc30 (patch)
tree17b9c00de2c62e68c965c742cdbc206f77a375da /drivers/of/module.c
parentReleasing progress-linux version 6.8.12-1~progress7.99u1. (diff)
downloadlinux-6d03a247468059b0e59c821ef39e6762d4d6fc30.tar.xz
linux-6d03a247468059b0e59c821ef39e6762d4d6fc30.zip
Merging upstream version 6.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/of/module.c')
-rw-r--r--drivers/of/module.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/of/module.c b/drivers/of/module.c
index 780fd82a7..f58e62495 100644
--- a/drivers/of/module.c
+++ b/drivers/of/module.c
@@ -29,15 +29,14 @@ ssize_t of_modalias(const struct device_node *np, char *str, ssize_t len)
csize = snprintf(str, len, "of:N%pOFn%c%s", np, 'T',
of_node_get_device_type(np));
tsize = csize;
- if (csize >= len)
- csize = len > 0 ? len - 1 : 0;
len -= csize;
- str += csize;
+ if (str)
+ str += csize;
of_property_for_each_string(np, "compatible", p, compat) {
csize = strlen(compat) + 1;
tsize += csize;
- if (csize >= len)
+ if (csize > len)
continue;
csize = snprintf(str, len, "C%s", compat);