nvme: Fix memory leak on error path of nvme_init
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 2 Jul 2025 16:02:10 +0000 (17:02 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 10 Jul 2025 14:41:23 +0000 (08:41 -0600)
commitf074616014179eefbca6f4b86b1fa6336711ba80
tree510cb7e6d4f31f8fb0147fe421a627d10159dd13
parent39b836d898782e31961afd16769c46d7f2730858
nvme: Fix memory leak on error path of nvme_init

The use of log_msg_ret to log a message and return an error meant that
memory allocated earlier in the function was not freed on this error
path. Instead log the message in the same way that log_msg_ret would do
and then goto the cleanup code to free the memory.

This issue found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/nvme/nvme.c