summaryrefslogtreecommitdiff
path: root/kernel/scftorture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-07-02 00:13:02 +0300
committerPaul E. McKenney <paulmck@kernel.org>2020-08-25 04:38:35 +0300
commit676e5469643e716df7f39ef77ba8f09c85b0c4f8 (patch)
tree4112eabf58abc567426eb9c573201f67140b620a /kernel/scftorture.c
parent34e8c4837adb579962e528a4f7dd1f75cb120be4 (diff)
downloadlinux-676e5469643e716df7f39ef77ba8f09c85b0c4f8.tar.xz
scftorture: Consolidate scftorture_invoke_one() check and kfree()
This commit moves checking of the ->scfc_out field and the freeing of the scf_check structure down below the end of switch statement, thus saving a few lines of code. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/scftorture.c')
-rw-r--r--kernel/scftorture.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 0d7299d32dd0..f220cd364e23 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -289,7 +289,7 @@ static void scf_handler_1(void *scfc_in)
static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp)
{
uintptr_t cpu;
- int ret;
+ int ret = 0;
struct scf_check *scfcp = NULL;
struct scf_selector *scfsp = scf_sel_rand(trsp);
@@ -322,11 +322,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
else
scfp->n_single_ofl++;
kfree(scfcp);
- } else if (scfcp && scfsp->scfs_wait) {
- if (WARN_ON_ONCE(!scfcp->scfc_out))
- atomic_inc(&n_mb_out_errs); // Leak rather than trash!
- else
- kfree(scfcp);
+ scfcp = NULL;
}
break;
case SCF_PRIM_MANY:
@@ -341,12 +337,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfcp->scfc_in = true;
}
smp_call_function_many(cpu_online_mask, scf_handler, scfcp, scfsp->scfs_wait);
- if (scfcp) {
- if (WARN_ON_ONCE(!scfcp->scfc_out))
- atomic_inc(&n_mb_out_errs); // Leak rather than trash!
- else
- kfree(scfcp);
- }
break;
case SCF_PRIM_ALL:
if (scfsp->scfs_wait)
@@ -360,14 +350,14 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfcp->scfc_in = true;
}
smp_call_function(scf_handler, scfcp, scfsp->scfs_wait);
- if (scfcp) {
- if (WARN_ON_ONCE(!scfcp->scfc_out))
- atomic_inc(&n_mb_out_errs); // Leak rather than trash!
- else
- kfree(scfcp);
- }
break;
}
+ if (scfcp && scfsp->scfs_wait) {
+ if (WARN_ON_ONCE(!scfcp->scfc_out))
+ atomic_inc(&n_mb_out_errs); // Leak rather than trash!
+ else
+ kfree(scfcp);
+ }
if (use_cpus_read_lock)
cpus_read_unlock();
else