]> Gentwo Git Trees - linux/.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)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 25 Nov 2025 16:52:24 +0000 (17:52 +0100)
commitc7418164b463056bf4327b6a2abe638b78250f13
tree5246c720af7982f3b50af2261b133866dc663e43
parentac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
timekeeping: Fix error code in tk_aux_sysfs_init()

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
kernel/time/timekeeping.c