Skip to contentSkip to conversation

sheepdog: Remove unnecessary NULL check in sd_prealloc()

PATCH Applied Peter Maydell 2 participants 2 messages May 18, 2018 – May 22, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sheepdog: Remove unnecessary NULL check in sd_prealloc()

In commit 8b9ad56e9cbfd852a, we removed the code that could result in our getting to sd_prealloc()'s out_with_err_set label with a NULL blk pointer. That makes the NULL check in the error-handling path unnecessary, and Coverity gripes about it (CID 1390636). Delete the redundant check.

---
 block/sheepdog.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
block/sheepdog.c +1 -3
index 4237132419..2a5bc0a59a 100644
@@ -1859,9 +1859,7 @@ out:
         error_setg_errno(errp, -ret, "Can't pre-allocate");
     }
 out_with_err_set:
-    if (blk) {
-        blk_unref(blk);
-    }
+    blk_unref(blk);
     g_free(buf);
 
     return ret;
Signature · 1 line
2.17.0
Applied
#1 lore raw

Am 18.05.2018 um 20:17 hat Peter Maydell geschrieben:

Quoted 7 lines

In commit 8b9ad56e9cbfd852a, we removed the code that could result in our getting to sd_prealloc()'s out_with_err_set label with a NULL blk pointer. That makes the NULL check in the error-handling path unnecessary, and Coverity gripes about it (CID 1390636). Delete the redundant check.

In fact, it was unnecessary even before that, because blk_unref(NULL) is valid (it does nothing).

Thanks, applied to the block branch.

Kevin