From: Bartosz Golaszewski Date: Mon, 27 Feb 2017 11:46:52 +0000 (+0100) Subject: tests: remove unnecessary goto X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7e849c3f5c380ab8f71941f996d50831ef53ab3c;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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); }