Skip to content

Commit

Permalink
util: remove unnecessary NULL check in cleanup_nvme_root()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
calebsander authored and igaw committed Jul 17, 2024
1 parent 648114f commit 4e61659
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions util/cleanup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4e61659

Please sign in to comment.