summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-02-19 06:27:46 -0700
committerJens Axboe <axboe@kernel.dk>2021-02-19 06:27:46 -0700
commit2927d4163552b98fad98fc48456a471d4b3e3dd1 (patch)
tree8c55ab89921e371e2f3fe3ab05b84d7d3a9bc0a2
parentb84afc4d675705adb980effcae6c1818eccd9ca8 (diff)
downloadliburing-2927d4163552b98fad98fc48456a471d4b3e3dd1.tar.gz
liburing-2927d4163552b98fad98fc48456a471d4b3e3dd1.tar.bz2
setup: cleanup probe code
Style and code flow improvements. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/setup.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/setup.c b/src/setup.c
index 94fec90..c01a933 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -181,20 +181,19 @@ void io_uring_queue_exit(struct io_uring *ring)
struct io_uring_probe *io_uring_get_probe_ring(struct io_uring *ring)
{
struct io_uring_probe *probe;
+ size_t len;
int r;
- size_t len = sizeof(*probe) + 256 * sizeof(struct io_uring_probe_op);
+ len = sizeof(*probe) + 256 * sizeof(struct io_uring_probe_op);
probe = malloc(len);
if (!probe)
return NULL;
memset(probe, 0, len);
r = io_uring_register_probe(ring, probe, 256);
- if (r < 0)
- goto fail;
+ if (r >= 0)
+ return probe;
- return probe;
-fail:
free(probe);
return NULL;
}
@@ -202,9 +201,10 @@ fail:
struct io_uring_probe *io_uring_get_probe(void)
{
struct io_uring ring;
- struct io_uring_probe* probe = NULL;
+ struct io_uring_probe *probe;
+ int r;
- int r = io_uring_queue_init(2, &ring, 0);
+ r = io_uring_queue_init(2, &ring, 0);
if (r < 0)
return NULL;