* [PATCH] IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc
@ 2015-02-13 7:58 Andrey Smirnov
2015-02-14 11:36 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2015-02-13 7:58 UTC (permalink / raw)
To: linux-iio; +Cc: Andrey Smirnov, linux-kernel, Jonathan Cameron
Since only a pointer to struct i2c_client is stored in a private area
of IIO device created by the driver there's no need to allocate
sizeof(struct i2c_client) worth of storage.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/iio/humidity/si7020.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
index 69e49f5..fa3b809 100644
--- a/drivers/iio/humidity/si7020.c
+++ b/drivers/iio/humidity/si7020.c
@@ -126,7 +126,7 @@ static int si7020_probe(struct i2c_client *client,
/* Wait the maximum power-up time after software reset. */
msleep(15);
- indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev)
return -ENOMEM;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc
2015-02-13 7:58 [PATCH] IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc Andrey Smirnov
@ 2015-02-14 11:36 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2015-02-14 11:36 UTC (permalink / raw)
To: Andrey Smirnov, linux-iio; +Cc: linux-kernel
On 13/02/15 07:58, Andrey Smirnov wrote:
> Since only a pointer to struct i2c_client is stored in a private area
> of IIO device created by the driver there's no need to allocate
> sizeof(struct i2c_client) worth of storage.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Applied to the fixes-togreg branch of iio.git.
Marked for stable to make sure this confusion doesn't arise
again!
Jonathan
> ---
> drivers/iio/humidity/si7020.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
> index 69e49f5..fa3b809 100644
> --- a/drivers/iio/humidity/si7020.c
> +++ b/drivers/iio/humidity/si7020.c
> @@ -126,7 +126,7 @@ static int si7020_probe(struct i2c_client *client,
> /* Wait the maximum power-up time after software reset. */
> msleep(15);
>
> - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> if (!indio_dev)
> return -ENOMEM;
>
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-14 11:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 7:58 [PATCH] IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc Andrey Smirnov
2015-02-14 11:36 ` Jonathan Cameron
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.