]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
util: remove unnecessary NULL check in cleanup_nvme_root()
authorCaleb Sander Mateos <csander@purestorage.com>
Tue, 16 Jul 2024 15:59:29 +0000 (09:59 -0600)
committerDaniel Wagner <wagi@monom.org>
Wed, 17 Jul 2024 15:00:04 +0000 (17:00 +0200)
cleanup_nvme_root() is checking whether the passed pointer is non-NULL,
but since the pointer is to a local variable, this will always be true.
Therefore, remove the check and always call nvme_free_tree().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
util/cleanup.h

index 0819523d7d4a6e91d4dad8fe282d7c04aa761f6a..f2acde0d3d5378520f4d585d0adf267f29014d5d 100644 (file)
@@ -38,8 +38,7 @@ static inline void cleanup_fd(int *fd)
 
 static inline void cleanup_nvme_root(nvme_root_t *r)
 {
-       if (r)
-               nvme_free_tree(*r);
+       nvme_free_tree(*r);
 }
 #define _cleanup_nvme_root_ __cleanup__(cleanup_nvme_root)