From 647cc34a1f1ac115e6278bceb95e18a75cc85def Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Fri, 5 Jul 2019 16:57:40 +0200 Subject: [PATCH] tests: gpio-mockup: store the number of chips in gpio_mockup_probe() 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 --- tests/mockup/gpio-mockup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/mockup/gpio-mockup.c b/tests/mockup/gpio-mockup.c index 358fec6..5a2b64c 100644 --- a/tests/mockup/gpio-mockup.c +++ b/tests/mockup/gpio-mockup.c @@ -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; -- 2.30.2