[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7f71c489-410b-4fdb-9d78-9f2835c32379@baylibre.com>
Date: Fri, 12 Sep 2025 13:40:37 -0500
From: David Lechner <dlechner@...libre.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH 2/7] iio: buffer: iio_push_to_buffers_with_ts_unaligned()
might_sleep()
On 9/12/25 1:10 PM, Andy Shevchenko wrote:
> On Fri, Sep 12, 2025 at 11:05:53AM -0500, David Lechner wrote:
>> Call might_sleep() in iio_push_to_buffers_with_ts_unaligned() since it
>> can allocate memory, which may sleep.
>
> It can or does it always do?
> If the first one is correct, better to use might_sleep_if().
>
Just below this in the function is:
if (iio_dev_opaque->bounce_buffer_size != indio_dev->scan_bytes) {
void *bb;
bb = devm_krealloc(&indio_dev->dev,
iio_dev_opaque->bounce_buffer,
indio_dev->scan_bytes, GFP_KERNEL);
if (!bb)
return -ENOMEM;
iio_dev_opaque->bounce_buffer = bb;
iio_dev_opaque->bounce_buffer_size = indio_dev->scan_bytes;
}
Would it make sense to move the might_sleep() inside of this
if statement rather than repeat the condition in might_sleep_if()?
devm_krealloc() is the only part of this function that might sleep.
Powered by blists - more mailing lists