]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/btrfs-util: simplify return conditions 32972/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 21 May 2024 07:08:48 +0000 (09:08 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 May 2024 11:55:45 +0000 (13:55 +0200)
Coverity has trouble undertanding this function, so let's get rid of the
redundant return branch to simplify the code.

src/shared/btrfs-util.c

index d6b218d842f69189146098bf937206002bdc6c58..a7881b8b7e77acac44ed7706ec03471f25bedf5e 100644 (file)
@@ -1637,13 +1637,10 @@ int btrfs_qgroup_find_parents(int fd, uint64_t qgroupid, uint64_t **ret) {
                         break;
         }
 
-        if (n_items <= 0) {
-                *ret = NULL;
-                return 0;
-        }
+        assert((n_items > 0) == !!items);
+        assert(n_items <= INT_MAX);
 
         *ret = TAKE_PTR(items);
-
         return (int) n_items;
 }