security/apparmor: remove redundant ret variable
authorMinghao Chi <chi.minghao@zte.com.cn>
Wed, 12 Jan 2022 08:03:56 +0000 (08:03 +0000)
committerJohn Johansen <john.johansen@canonical.com>
Sat, 9 Jul 2022 22:13:59 +0000 (15:13 -0700)
Return value from nf_register_net_hooks() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/lsm.c

index 301c2bba4867d82384333cf49a79072f136a401a..1ebcf1a6e1d003ee330df128d93fa4c31122b553 100644 (file)
@@ -1825,11 +1825,8 @@ static const struct nf_hook_ops apparmor_nf_ops[] = {
 
 static int __net_init apparmor_nf_register(struct net *net)
 {
-       int ret;
-
-       ret = nf_register_net_hooks(net, apparmor_nf_ops,
+       return nf_register_net_hooks(net, apparmor_nf_ops,
                                    ARRAY_SIZE(apparmor_nf_ops));
-       return ret;
 }
 
 static void __net_exit apparmor_nf_unregister(struct net *net)