Documentation: kunit: Warn that exit functions run even if init fails
authorDavid Gow <davidgow@google.com>
Wed, 10 May 2023 05:38:31 +0000 (13:38 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 12 May 2023 00:17:35 +0000 (18:17 -0600)
commitcdc87bda607518e70b6a6745cd593458d725b5a7
tree790528bb739eeb915f028c997818c2fdb8c7cb2d
parent410f07492eaef600fe817eef9fd272f6692a451a
Documentation: kunit: Warn that exit functions run even if init fails

KUnit's exit functions will run even if the corresponding init function
fails. It's easy, when writing an exit function, to assume the init
function succeeded, and (for example) access uninitialised memory or
dereference NULL pointers.

Note that this case exists and should be handled in the documentation.

Suggested-by: Benjamin Berg <benjamin@sipsolutions.net>
Link: https://lore.kernel.org/linux-kselftest/a39af0400abedb2e9b31d84c37551cecc3eed0e1.camel@sipsolutions.net/
Reviewed-by: Sadiya Kazi <sadiyakazi@google.com>
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Documentation/dev-tools/kunit/usage.rst
include/kunit/test.h