]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
timekeeping: Fix error code in tk_aux_sysfs_init()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 25 Nov 2025 13:55:19 +0000 (16:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:27:34 +0000 (06:27 +0900)
commit152c4bc73c3dbaa9f0bcfbeaef09dd5627dc7b5c
treeabf1f9ab293790a76bda0af1a10ea4607581e06c
parentfd50547165444d6b8bf5df99ed27d37d02c6f976
timekeeping: Fix error code in tk_aux_sysfs_init()

commit c7418164b463056bf4327b6a2abe638b78250f13 upstream.

If kobject_create_and_add() fails on the first iteration, then the error
code is set to -ENOMEM which is correct. But if it fails in subsequent
iterations then "ret" is zero, which means success, but it should be
-ENOMEM.

Set the error code to -ENOMEM correctly.

Fixes: 7b5ab04f035f ("timekeeping: Fix resource leak in tk_aux_sysfs_init() error paths")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Malaya Kumar Rout <mrout@redhat.com>
Link: https://patch.msgid.link/aSW1R8q5zoY_DgQE@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/time/timekeeping.c