The patch titled Subject: fail_function: refctor code of checking return value of register_kprobe() has been added to the -mm mm-nonmm-unstable branch. Its filename is fail_function-refctor-code-of-checking-return-value-of-register_kprobe.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fail_function-refctor-code-of-checking-return-value-of-register_kprobe.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yang Yingliang <yangyingliang@xxxxxxxxxx> Subject: fail_function: refctor code of checking return value of register_kprobe() Date: Fri, 26 Aug 2022 15:33:36 +0800 Refactor the error handling of register_kprobe() to improve readability. No functional change. Link: https://lkml.kernel.org/r/20220826073337.2085798-2-yangyingliang@xxxxxxxxxx Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/fail_function.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/kernel/fail_function.c~fail_function-refctor-code-of-checking-return-value-of-register_kprobe +++ a/kernel/fail_function.c @@ -294,14 +294,13 @@ static ssize_t fei_write(struct file *fi } ret = register_kprobe(&attr->kp); - if (!ret) - fei_debugfs_add_attr(attr); - if (ret < 0) + if (ret) { fei_attr_remove(attr); - else { - list_add_tail(&attr->list, &fei_attr_list); - ret = count; + goto out; } + fei_debugfs_add_attr(attr); + list_add_tail(&attr->list, &fei_attr_list); + ret = count; out: mutex_unlock(&fei_lock); kfree(buf); _ Patches currently in -mm which might be from yangyingliang@xxxxxxxxxx are nommu-remove-uses-of-vma-linked-list-fix.patch fail_function-switch-to-memdup_user_nul-helper.patch fail_function-refctor-code-of-checking-return-value-of-register_kprobe.patch fail_function-fix-wrong-use-of-fei_attr_remove.patch