linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:callback buffer: free the scan_mask
@ 2013-05-22 21:41 Jonathan Cameron
  2013-06-02 15:57 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Cameron @ 2013-05-22 21:41 UTC (permalink / raw)
  To: linux-iio; +Cc: mirq-linux, Jonathan Cameron

Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
As per original discussion I've now put together a minimal patch.
The rework suggested was reasonable but had no place in a fix patch.

 drivers/iio/buffer_cb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c
index 9201022..9d19ba7 100644
--- a/drivers/iio/buffer_cb.c
+++ b/drivers/iio/buffer_cb.c
@@ -64,7 +64,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
 	while (chan->indio_dev) {
 		if (chan->indio_dev != indio_dev) {
 			ret = -EINVAL;
-			goto error_release_channels;
+			goto error_free_scan_mask;
 		}
 		set_bit(chan->channel->scan_index,
 			cb_buff->buffer.scan_mask);
@@ -73,6 +73,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
 
 	return cb_buff;
 
+error_free_scan_mask:
+	kfree(cb_buff->buffer.scan_mask);
 error_release_channels:
 	iio_channel_release_all(cb_buff->channels);
 error_free_cb_buff:
@@ -100,6 +102,7 @@ EXPORT_SYMBOL_GPL(iio_channel_stop_all_cb);
 
 void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buff)
 {
+	kfree(cb_buff->buffer.scan_mask);
 	iio_channel_release_all(cb_buff->channels);
 	kfree(cb_buff);
 }
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio:callback buffer: free the scan_mask
  2013-05-22 21:41 [PATCH] iio:callback buffer: free the scan_mask Jonathan Cameron
@ 2013-06-02 15:57 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2013-06-02 15:57 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, mirq-linux

On 05/22/2013 10:41 PM, Jonathan Cameron wrote:
> Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>

Applied to fixes-togreg branch of iio.git

Sometimes I think no one cares, then I remember that there are no
in tree users of this code so probably no one does ;)
> ---
> As per original discussion I've now put together a minimal patch.
> The rework suggested was reasonable but had no place in a fix patch.
> 
>  drivers/iio/buffer_cb.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c
> index 9201022..9d19ba7 100644
> --- a/drivers/iio/buffer_cb.c
> +++ b/drivers/iio/buffer_cb.c
> @@ -64,7 +64,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
>  	while (chan->indio_dev) {
>  		if (chan->indio_dev != indio_dev) {
>  			ret = -EINVAL;
> -			goto error_release_channels;
> +			goto error_free_scan_mask;
>  		}
>  		set_bit(chan->channel->scan_index,
>  			cb_buff->buffer.scan_mask);
> @@ -73,6 +73,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
>  
>  	return cb_buff;
>  
> +error_free_scan_mask:
> +	kfree(cb_buff->buffer.scan_mask);
>  error_release_channels:
>  	iio_channel_release_all(cb_buff->channels);
>  error_free_cb_buff:
> @@ -100,6 +102,7 @@ EXPORT_SYMBOL_GPL(iio_channel_stop_all_cb);
>  
>  void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buff)
>  {
> +	kfree(cb_buff->buffer.scan_mask);
>  	iio_channel_release_all(cb_buff->channels);
>  	kfree(cb_buff);
>  }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-02 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 21:41 [PATCH] iio:callback buffer: free the scan_mask Jonathan Cameron
2013-06-02 15:57 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).