All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Mark Brown" <broonie@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH v2 01/11] iio: adc: ad_sigma_delta: don't overallocate scan buffer
Date: Sat, 28 Jun 2025 16:04:02 +0100	[thread overview]
Message-ID: <20250628160402.1f97c0fe@jic23-huawei> (raw)
In-Reply-To: <20250628155521.056b3394@jic23-huawei>

On Sat, 28 Jun 2025 15:55:21 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 27 Jun 2025 18:39:57 -0500
> David Lechner <dlechner@baylibre.com> wrote:
> 
> > Fix overallocating the size of the scan buffer by converting bits to
> > bytes. The size is meant to be in bytes, so scanbits needs to be
> > divided by 8.
> > 
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---
> >  drivers/iio/adc/ad_sigma_delta.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
> > index 4c5f8d29a559fea7226b84141bcb148fb801f62c..6b3ef7ef403e00804abeb81025ed293b188e492b 100644
> > --- a/drivers/iio/adc/ad_sigma_delta.c
> > +++ b/drivers/iio/adc/ad_sigma_delta.c
> > @@ -489,7 +489,7 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev)
> >  			return ret;
> >  	}
> >  
> > -	samples_buf_size = ALIGN(slot * indio_dev->channels[0].scan_type.storagebits, 8);
> > +	samples_buf_size = ALIGN(slot * indio_dev->channels[0].scan_type.storagebits / 8, 8);  
> 
> Seems like a good place for BITS_TO_BYTES() from bitops.h.  Given we have another 8
> kicking around in the same code line it might be a tiny bit confusing as / 8
> 
> If everything else is good I'll tweak this whilst applying (and add the include if needed).

Found it in patch 4.   No problem doing it there.  'Maybe' a hint in the description would
have been a nice to have, but not particularly important.

> 
> >  	samples_buf_size += sizeof(int64_t);
> >  	samples_buf = devm_krealloc(&sigma_delta->spi->dev, sigma_delta->samples_buf,
> >  				    samples_buf_size, GFP_KERNEL);
> >   
> 


  reply	other threads:[~2025-06-28 15:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 23:39 [PATCH v2 00/11] iio: adc: ad7173: add SPI offload support David Lechner
2025-06-27 23:39 ` [PATCH v2 01/11] iio: adc: ad_sigma_delta: don't overallocate scan buffer David Lechner
2025-06-28 14:55   ` Jonathan Cameron
2025-06-28 15:04     ` Jonathan Cameron [this message]
2025-06-27 23:39 ` [PATCH v2 02/11] iio: adc: ad_sigma_delta: sort includes David Lechner
2025-06-27 23:39 ` [PATCH v2 03/11] iio: adc: ad_sigma_delta: use u8 instead of uint8_t David Lechner
2025-06-27 23:40 ` [PATCH v2 04/11] iio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro David Lechner
2025-06-28 14:56   ` Jonathan Cameron
2025-06-30  8:59     ` Andy Shevchenko
2025-06-30 13:33       ` David Lechner
2025-07-01 13:47         ` Andy Shevchenko
2025-07-01 17:36           ` Jonathan Cameron
2025-06-27 23:40 ` [PATCH v2 05/11] iio: adc: ad_sigma_delta: audit included headers David Lechner
2025-06-30  9:02   ` Andy Shevchenko
2025-06-27 23:40 ` [PATCH v2 06/11] iio: adc: ad_sigma_delta: refactor setting read address David Lechner
2025-06-27 23:40 ` [PATCH v2 07/11] iio: adc: ad_sigma_delta: use spi_optimize_message() David Lechner
2025-06-27 23:40 ` [PATCH v2 08/11] dt-bindings: trigger-source: add ADI Util Sigma-Delta SPI David Lechner
2025-06-27 23:40 ` [PATCH v2 09/11] spi: offload trigger: add ADI Util Sigma-Delta SPI driver David Lechner
2025-06-28 15:02   ` Jonathan Cameron
2025-07-01 20:57     ` David Lechner
2025-06-30  9:05   ` Andy Shevchenko
2025-06-27 23:40 ` [PATCH v2 10/11] iio: adc: ad_sigma_delta: add SPI offload support David Lechner
2025-06-27 23:40 ` [PATCH v2 11/11] iio: adc: ad7173: " David Lechner
2025-07-02 13:27 ` (subset) [PATCH v2 00/11] " Mark Brown

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=20250628160402.1f97c0fe@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.