tests: gpio-mockup: store the number of chips in gpio_mockup_probe()
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 5 Jul 2019 14:57:40 +0000 (16:57 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 5 Jul 2019 14:57:40 +0000 (16:57 +0200)
We're currently not storing the number of chips in the gpio-mockup
context structure after probing the module. The value is left
initialized to 0. This leads to both a memory leak and to chip ordering
errors when running the tests at high CPU loads. This patch fixes both
issues.

Fixes: e43e46d4f79c ("tests: mockup: add a library for controlling the gpio-mockup module")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
tests/mockup/gpio-mockup.c

index 358fec639fe1ebf46ced60d3d95c1b06b95c2784..5a2b64c72edaeb8dc2ba34c4cff9fdd7a46e6d1a 100644 (file)
@@ -304,6 +304,8 @@ EXPORT int gpio_mockup_probe(struct gpio_mockup *ctx, unsigned int num_chips,
        if (!ctx->chips)
                goto err_remove_module;
 
+       ctx->num_chips = num_chips;
+
        pfd.fd = udev_monitor_get_fd(monitor);
        pfd.events = POLLIN | POLLPRI;