]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
modprobe: move check for remove_holders to caller
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 29 Mar 2022 09:05:39 +0000 (02:05 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 7 Apr 2022 05:04:38 +0000 (22:04 -0700)
Do not mix the flags with and additional boolean from arguments.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
tools/modprobe.c

index 32b6f7ff0e87a2c67ef14d8e62b04c18b027c672..45952a6d8b82cb08ef51ffba138cdee9577db569 100644 (file)
@@ -418,7 +418,7 @@ static int rmmod_do_module(struct kmod_module *mod, int flags)
 
        rmmod_do_modlist(post, false);
 
-       if ((flags & RMMOD_FLAG_REMOVE_HOLDERS) && remove_holders) {
+       if (flags & RMMOD_FLAG_REMOVE_HOLDERS) {
                struct kmod_list *holders = kmod_module_get_holders(mod);
 
                err = rmmod_do_modlist(holders, true);
@@ -471,7 +471,9 @@ static int rmmod(struct kmod_ctx *ctx, const char *alias)
 
        kmod_list_foreach(l, list) {
                struct kmod_module *mod = kmod_module_get_module(l);
-               err = rmmod_do_module(mod, RMMOD_FLAG_REMOVE_HOLDERS);
+               int flags = remove_holders ? RMMOD_FLAG_REMOVE_HOLDERS : 0;
+
+               err = rmmod_do_module(mod, flags);
                kmod_module_unref(mod);
                if (err < 0)
                        break;