kunit: alloc_string_stream_fragment error handling bug fix
authorYoungJun.park <her0gyugyu@gmail.com>
Fri, 28 Oct 2022 14:42:41 +0000 (07:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:41 +0000 (12:02 +0100)
commit84cc257e1888862e3018db2c402b44b8915c1eb1
treebbb806e9ecef9d853dcb1bd933f8859f50d334a9
parent8b2de52126612b6d99f637292fc3aaceb42efc8a
kunit: alloc_string_stream_fragment error handling bug fix

[ Upstream commit 93ef83050e597634d2c7dc838a28caf5137b9404 ]

When it fails to allocate fragment, it does not free and return error.
And check the pointer inappropriately.

Fixed merge conflicts with
commit 618887768bb7 ("kunit: update NULL vs IS_ERR() tests")
Shuah Khan <skhan@linuxfoundation.org>

Signed-off-by: YoungJun.park <her0gyugyu@gmail.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/kunit/string-stream.c