aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-05-24 01:46:25 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-27 16:15:40 +0900
commitc5c468dcc25efc0095361bb63b6255622e22f695 (patch)
treeefdd5e9901d8fe8901d4c293fc4a61d0fc02bae1 /scripts/mod/modpost.c
parentmodpost: remove the unused argument of check_sec_ref() (diff)
downloadlinux-dev-c5c468dcc25efc0095361bb63b6255622e22f695.tar.xz
linux-dev-c5c468dcc25efc0095361bb63b6255622e22f695.zip
modpost: reuse ARRAY_SIZE() macro for section_mismatch()
Move ARRAY_SIZE() from file2alias.c to modpost.h to reuse it in section_mismatch(). Also, move the variable 'check' inside the for-loop. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to '')
-rw-r--r--scripts/mod/modpost.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2806a5c528c8..fc8ba8585d23 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1049,8 +1049,6 @@ static const struct sectioncheck *section_mismatch(
const char *fromsec, const char *tosec)
{
int i;
- int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck);
- const struct sectioncheck *check = &sectioncheck[0];
/*
* The target section could be the SHT_NUL section when we're
@@ -1061,14 +1059,15 @@ static const struct sectioncheck *section_mismatch(
if (*tosec == '\0')
return NULL;
- for (i = 0; i < elems; i++) {
+ for (i = 0; i < ARRAY_SIZE(sectioncheck); i++) {
+ const struct sectioncheck *check = &sectioncheck[i];
+
if (match(fromsec, check->fromsec)) {
if (check->bad_tosec[0] && match(tosec, check->bad_tosec))
return check;
if (check->good_tosec[0] && !match(tosec, check->good_tosec))
return check;
}
- check++;
}
return NULL;
}