From: dave p. <dpe...@gm...> - 2024-07-16 16:43:18
|
Hi Michael, Thanks for the patch - applied to git. cheers, -Dave On Sun, 14 Jul 2024 at 19:05, Michael Schwingen <mi...@sc...> wrote: > > Hi, > > I noticed crashes when unloading the gpib_bitbang module after upgrading my > development raspberry pi to kernel 6.6. I traced them to the use of > gpiod_put on GPIO objects that were not allocated using gpiod_get, which > according to the ernel documentation should not be done. > > The attached patch fixes the problem for me. > > cu > Michael Schwingen > > > > From cb23c0aa14effc437041c39eb24178ca5f11e74c Mon Sep 17 00:00:00 2001 > From: Michael Schwingen <mi...@sc...> > Date: Fri, 12 Jul 2024 16:35:08 +0200 > Subject: [PATCH 1/2] do not use gpiod_put on GPIOs that were not allocated > with gpiod_get (fixes crash on module unload on kernel 6.6) > > --- > linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c > b/linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c > index 5d5a2690..7aebf119 100644 > --- a/linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c > +++ b/linux-gpib-kernel/drivers/gpib/gpio/gpib_bitbang.c > @@ -971,7 +971,6 @@ static int allocate_gpios(void) { > if ( j != last) { /* error - undo what already > done */ > dbg_printk (0, "request for gpios failed at %d.\n", j); > while (j) { > - gpiod_put(all_descriptors[--j]); > all_descriptors[j] = 0; > gpio_free (gpios_vector[j]+gpio_offset); > } > @@ -985,7 +984,6 @@ static void release_gpios(void) { > int j = sn7516x ? GPIB_PINS + SN7516X_PINS : GPIB_PINS ; > while (j) { > if (all_descriptors[--j]) { > - gpiod_put(all_descriptors[j]); > all_descriptors[j] = 0; > gpio_free (gpios_vector[j]+gpio_offset); > } > @@ -1144,7 +1142,6 @@ static int __init bb_init_module(void) > static void __exit bb_exit_module(void) > { > gpiod_direction_input(ACT_LED); > - gpiod_put(ACT_LED); > > dbg_printk(1,"%s\n", "module unloaded!"); > > -- > 2.39.2 > > > > > _______________________________________________ > Linux-gpib-general mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linux-gpib-general > |