From: Bartosz Golaszewski Date: Mon, 25 Apr 2022 12:35:56 +0000 (+0200) Subject: gpiosim: initialize the bank's num_lines field to 1 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d5ea8c9ed1fcf187e1b59cf448427b902a3d9aff;p=qemu-gpiodev%2Flibgpiod.git gpiosim: initialize the bank's num_lines field to 1 If we create a simulated chip and never set the num_lines property, the num_lines field remains set to 0 and the potential lineX and hog directories within the bank's directory will not get removed so the removal of the bank's and device's directories will fail too leaving a dangling chip in place. Initialize bank->num_lines to 1 to avoid this issue. Fixes: a2f6e8cd3540 ("libgpiosim: new library for controlling the gpio-sim module") Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/gpiosim/gpiosim.c b/tests/gpiosim/gpiosim.c index 6e36dfd..0ce0fd0 100644 --- a/tests/gpiosim/gpiosim.c +++ b/tests/gpiosim/gpiosim.c @@ -781,6 +781,7 @@ gpiosim_bank_new(struct gpiosim_dev *dev, const char *name) bank->cfs_dir_fd = configfs_fd; bank->dev = gpiosim_dev_ref(dev); bank->item_name = item_name; + bank->num_lines = 1; return bank;