public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: "Cosmin Tanislav" <demonsingur@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Cosmin Tanislav" <cosmin.tanislav@analog.com>
Subject: Re: [PATCH 1/3] iio: temperature: ltc2983: allocate iio channels once
Date: Sat, 15 Oct 2022 17:35:43 +0100	[thread overview]
Message-ID: <20221015173543.4b3f6d5d@jic23-huawei> (raw)
In-Reply-To: <20221014161824.00001ca2@huawei.com>

On Fri, 14 Oct 2022 16:18:24 +0100
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Fri, 14 Oct 2022 15:11:47 +0100
> Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> 
> > On Fri, 14 Oct 2022 15:37:22 +0300
> > Cosmin Tanislav <demonsingur@gmail.com> wrote:
> >   
> > > From: Cosmin Tanislav <cosmin.tanislav@analog.com>
> > > 
> > > Currently, every time the device wakes up from sleep, the
> > > iio_chan array is reallocated, leaking the previous one
> > > until the device is removed (basically never).
> > > 
> > > Move the allocation to the probe function to avoid this.
> > > 
> > > Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>    
> > Hi Cosmin,
> > 
> > Please give a fixes tag for this one as we'll definitely want to
> > backport it.
> > 
> > Reply to this patch is fine as b4 will pick it up like any other tag.  
> Fixes: f110f3188e563 ("iio: temperature: Add support for LTC2983")
> 
> (from direct mail)
> 
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> >   
> > > ---
> > >  drivers/iio/temperature/ltc2983.c | 13 ++++++-------
> > >  1 file changed, 6 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
> > > index b652d2b39bcf..a60ccf183687 100644
> > > --- a/drivers/iio/temperature/ltc2983.c
> > > +++ b/drivers/iio/temperature/ltc2983.c
> > > @@ -1385,13 +1385,6 @@ static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio)
> > >  		return ret;
> > >  	}
> > >  
> > > -	st->iio_chan = devm_kzalloc(&st->spi->dev,
> > > -				    st->iio_channels * sizeof(*st->iio_chan),
> > > -				    GFP_KERNEL);
> > > -
> > > -	if (!st->iio_chan)
> > > -		return -ENOMEM;
> > > -
> > >  	ret = regmap_update_bits(st->regmap, LTC2983_GLOBAL_CONFIG_REG,
> > >  				 LTC2983_NOTCH_FREQ_MASK,
> > >  				 LTC2983_NOTCH_FREQ(st->filter_notch_freq));
> > > @@ -1514,6 +1507,12 @@ static int ltc2983_probe(struct spi_device *spi)
> > >  		gpiod_set_value_cansleep(gpio, 0);
> > >  	}
> > >  
> > > +	st->iio_chan = devm_kzalloc(&spi->dev,
> > > +				    st->iio_channels * sizeof(*st->iio_chan),
> > > +				    GFP_KERNEL);
> > > +	if (!st->iio_chan)
> > > +		return -ENOMEM;
> > > +
> > >  	ret = ltc2983_setup(st, true);
> > >  	if (ret)
> > >  		return ret;    
> > 
> >   
> 


  reply	other threads:[~2022-10-15 16:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 12:37 [PATCH 0/3] Support more parts in LTC2983 Cosmin Tanislav
2022-10-14 12:37 ` [PATCH 1/3] iio: temperature: ltc2983: allocate iio channels once Cosmin Tanislav
2022-10-14 14:11   ` Jonathan Cameron
2022-10-14 15:18     ` Jonathan Cameron
2022-10-15 16:35       ` Jonathan Cameron [this message]
2022-10-14 12:37 ` [PATCH 2/3] dt-bindings: iio: temperature: ltc2983: support more parts Cosmin Tanislav
2022-10-14 15:37   ` Jonathan Cameron
2022-10-17  7:01     ` Cosmin Tanislav
2022-10-17 10:22       ` Jonathan Cameron
2022-10-17  1:59   ` Krzysztof Kozlowski
2022-10-17  6:53     ` Cosmin Tanislav
2022-10-17 10:26       ` Jonathan Cameron
2022-10-17 10:37         ` Jonathan Cameron
2022-10-17 23:26       ` Krzysztof Kozlowski
2022-10-17  9:38     ` Nuno Sá
2022-10-17 10:04       ` Nuno Sá
2022-10-17 23:32       ` Krzysztof Kozlowski
2022-10-18  6:01         ` Nuno Sá
2022-10-14 12:37 ` [PATCH 3/3] " Cosmin Tanislav
2022-10-14 15:44   ` Jonathan Cameron
2022-10-17  6:59     ` Cosmin Tanislav
2022-10-17 10:29       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221015173543.4b3f6d5d@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=demonsingur@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox