From 7e849c3f5c380ab8f71941f996d50831ef53ab3c Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 27 Feb 2017 12:46:52 +0100 Subject: [PATCH] tests: remove unnecessary goto Check all loop conditions in a single if in test_prepare() and remove the 'cont' label. Signed-off-by: Bartosz Golaszewski --- tests/unit/gpiod-unit.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/unit/gpiod-unit.c b/tests/unit/gpiod-unit.c index 0f3dba0..9083e9d 100644 --- a/tests/unit/gpiod-unit.c +++ b/tests/unit/gpiod-unit.c @@ -304,11 +304,12 @@ static void test_prepare(struct gu_chip_descr *descr) devpath = udev_device_get_devpath(dev); devnode = udev_device_get_devnode(dev); sysname = udev_device_get_sysname(dev); - if (!devpath || !devnode || !sysname) - goto cont; - if (!devpath_is_mockup(devpath)) - goto cont; + if (!devpath || !devnode || !sysname || + !devpath_is_mockup(devpath)) { + udev_device_unref(dev); + continue; + } chip = xzalloc(sizeof(*chip)); chip->name = xstrdup(sysname); @@ -318,8 +319,6 @@ static void test_prepare(struct gu_chip_descr *descr) die("unable to determine chip number"); ctx->chips[detected++] = chip; - -cont: udev_device_unref(dev); } -- 2.30.2