On Fri, 8 May 2020 17:39:35 +0300 Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> wrote: > This change makes the use of devm_iio_kfifo_allocate() to attach the > life-cycle of the kfifo buffer to the parent (client->dev) object. > > This removes the need to explicitly free 'indio_dev->buffer' via > iio_kfifo_free(), which is the main intent. > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> *mutters darkly*. Technically this patch adds a non obvious ordering issue in remove, but then you fix it in the next one so I'll let that go. However, you've not tried building patch 1 on it's own.. drivers/staging/iio/impedance-analyzer/ad5933.c:752:17: error: label 'error_unreg_ring' was not declared drivers/staging/iio/impedance-analyzer/ad5933.c:756:17: error: label 'error_unreg_ring' was not declared CC [M] drivers/staging/iio/impedance-analyzer/ad5933.o drivers/staging/iio/impedance-analyzer/ad5933.c: In function ‘ad5933_probe’: drivers/staging/iio/impedance-analyzer/ad5933.c:756:3: error: label ‘error_unreg_ring’ used but not defined 756 | goto error_unreg_ring; | ^~~~ make[4]: *** [scripts/Makefile.build:267: drivers/staging/iio/impedance-analyzer/ad5933.o] Error 1 make[3]: *** [scripts/Makefile.build:488: drivers/staging/iio/impedance-analyzer] Error 2 make[2]: *** [scripts/Makefile.build:488: drivers/staging/iio] Error 2 make[1]: *** [scripts/Makefile.build:488: drivers/staging] Error 2 make: *** [Makefile:1722: drivers] Error 2 Easiest option here is just to merge the two patches into one. I've done that and mashed the two commit messages into one semi-coherent whole. Applied both patches as one to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. thanks, Jonathan > --- > drivers/staging/iio/impedance-analyzer/ad5933.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c > index af0bcf95ee8a..633adf1a08c1 100644 > --- a/drivers/staging/iio/impedance-analyzer/ad5933.c > +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c > @@ -602,11 +602,12 @@ static const struct iio_buffer_setup_ops ad5933_ring_setup_ops = { > .postdisable = ad5933_ring_postdisable, > }; > > -static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev) > +static int ad5933_register_ring_funcs_and_init(struct device *dev, > + struct iio_dev *indio_dev) > { > struct iio_buffer *buffer; > > - buffer = iio_kfifo_allocate(); > + buffer = devm_iio_kfifo_allocate(dev); > if (!buffer) > return -ENOMEM; > > @@ -742,7 +743,7 @@ static int ad5933_probe(struct i2c_client *client, > indio_dev->channels = ad5933_channels; > indio_dev->num_channels = ARRAY_SIZE(ad5933_channels); > > - ret = ad5933_register_ring_funcs_and_init(indio_dev); > + ret = ad5933_register_ring_funcs_and_init(&client->dev, indio_dev); > if (ret) > goto error_disable_mclk; > > @@ -756,8 +757,6 @@ static int ad5933_probe(struct i2c_client *client, > > return 0; > > -error_unreg_ring: > - iio_kfifo_free(indio_dev->buffer); > error_disable_mclk: > clk_disable_unprepare(st->mclk); > error_disable_reg: > @@ -772,7 +771,6 @@ static int ad5933_remove(struct i2c_client *client) > struct ad5933_state *st = iio_priv(indio_dev); > > iio_device_unregister(indio_dev); > - iio_kfifo_free(indio_dev->buffer); > regulator_disable(st->reg); > clk_disable_unprepare(st->mclk); >