diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2014-07-26 17:57:01 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-07-27 07:22:45 -0400 |
commit | fcd38ed0ff263156c3917c70c2fb0b7e91bfeab1 (patch) | |
tree | a0fef8e6a66ebf755af71069dd776b6a0a7d167b /scripts | |
parent | 37549e94c77a94a9c32b5ae3313a3801cb66adf9 (diff) |
scripts: modpost: fix compilation warning
The scripts/mod/modpost.c triggers the following warning:
scripts/mod/modpost.c: In function ‘remove_dot’:
scripts/mod/modpost.c:1710:10: warning: ignoring return value of ‘strtoul’, declared with attribute warn_unused_result [-Wunused-result]
The remove_dot function that calls strtoul does not care about the
numeric value of the string that is parsed but only looks for the
end of the numeric sequence. As such, it's equivalent to just skip
over all digits.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/modpost.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9d9c5b905b35..5ba203b9eddf 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1703,12 +1703,11 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
1703 | 1703 | ||
1704 | static char *remove_dot(char *s) | 1704 | static char *remove_dot(char *s) |
1705 | { | 1705 | { |
1706 | char *end; | 1706 | size_t n = strcspn(s, "."); |
1707 | int n = strcspn(s, "."); | ||
1708 | 1707 | ||
1709 | if (n > 0 && s[n] != 0) { | 1708 | if (n && s[n]) { |
1710 | strtoul(s + n + 1, &end, 10); | 1709 | size_t m = strspn(s + n + 1, "0123456789"); |
1711 | if (end > s + n + 1 && (*end == '.' || *end == 0)) | 1710 | if (m && (s[n + m] == '.' || s[n + m] == 0)) |
1712 | s[n] = 0; | 1711 | s[n] = 0; |
1713 | } | 1712 | } |
1714 | return s; | 1713 | return s; |