From: Jonathan Cameron <jic23@cam.ac.uk>
To: Andre Bartke <andre.bartke@googlemail.com>
Cc: gregkh@suse.de, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
Andre Bartke <andre.bartke@gmail.com>
Subject: Re: [PATCH] staging/iio: error case memory leak fix
Date: Thu, 02 Jun 2011 16:15:59 +0100 [thread overview]
Message-ID: <4DE7A92F.7090702@cam.ac.uk> (raw)
In-Reply-To: <1306966905-13799-1-git-send-email-andre.bartke@gmail.com>
On 06/01/11 23:21, Andre Bartke wrote:
> The data pointer should be freed in the error
> cases of adis16400_trigger_handler().
Thanks.
>
> Signed-off-by: Andre Bartke <andre.bartke@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> drivers/staging/iio/imu/adis16400_ring.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c
> index 2589a7e..3612373 100644
> --- a/drivers/staging/iio/imu/adis16400_ring.c
> +++ b/drivers/staging/iio/imu/adis16400_ring.c
> @@ -137,13 +137,13 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)
> if (st->variant->flags & ADIS16400_NO_BURST) {
> ret = adis16350_spi_read_all(&indio_dev->dev, st->rx);
> if (ret < 0)
> - return ret;
> + goto err;
> for (; i < ring->scan_count; i++)
> data[i] = *(s16 *)(st->rx + i*2);
> } else {
> ret = adis16400_spi_read_burst(&indio_dev->dev, st->rx);
> if (ret < 0)
> - return ret;
> + goto err;
> for (; i < indio_dev->ring->scan_count; i++) {
> j = __ffs(mask);
> mask &= ~(1 << j);
> @@ -158,9 +158,13 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)
> ring->access->store_to(indio_dev->ring, (u8 *) data, pf->timestamp);
>
> iio_trigger_notify_done(indio_dev->trig);
> - kfree(data);
>
> + kfree(data);
> return IRQ_HANDLED;
> +
> +err:
> + kfree(data);
> + return ret;
> }
>
> void adis16400_unconfigure_ring(struct iio_dev *indio_dev)
prev parent reply other threads:[~2011-06-02 15:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 22:21 [PATCH] staging/iio: error case memory leak fix Andre Bartke
2011-06-02 15:15 ` Jonathan Cameron [this message]
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=4DE7A92F.7090702@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=andre.bartke@gmail.com \
--cc=andre.bartke@googlemail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.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