linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] inkern: iio_device_put after incorrect return/goto
       [not found] <60123fd3175b7cceadf6c335b12e58b797e18f65.1370356776.git.joe@perches.com>
@ 2013-06-04 14:44 ` Joe Perches
  2013-06-04 17:28   ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2013-06-04 14:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jonathan Cameron, linux-iio

The code uses

    return foo;
    goto err_type;

when instead the form should have been

    ret = foo;
    goto err_type;

Here this causes a useful iio_device_put to be skipped.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/iio/inkern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 795d100..dca4eed 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -124,7 +124,7 @@ static int __of_iio_channel_get(struct iio_channel *channel,
 	channel->indio_dev = indio_dev;
 	index = iiospec.args_count ? iiospec.args[0] : 0;
 	if (index >= indio_dev->num_channels) {
-		return -EINVAL;
+		err = -EINVAL;
 		goto err_put;
 	}
 	channel->channel = &indio_dev->channels[index];
-- 
1.8.1.2.459.gbcd45b4.dirty


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

* Re: [PATCH 2/4] inkern: iio_device_put after incorrect return/goto
  2013-06-04 14:44 ` [PATCH 2/4] inkern: iio_device_put after incorrect return/goto Joe Perches
@ 2013-06-04 17:28   ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2013-06-04 17:28 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Jonathan Cameron, linux-iio

On 06/04/2013 03:44 PM, Joe Perches wrote:
> The code uses
> 
>     return foo;
>     goto err_type;
> 
> when instead the form should have been
> 
>     ret = foo;
>     goto err_type;
> 
> Here this causes a useful iio_device_put to be skipped.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
Applied to fixes-togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/inkern.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 795d100..dca4eed 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -124,7 +124,7 @@ static int __of_iio_channel_get(struct iio_channel *channel,
>  	channel->indio_dev = indio_dev;
>  	index = iiospec.args_count ? iiospec.args[0] : 0;
>  	if (index >= indio_dev->num_channels) {
> -		return -EINVAL;
> +		err = -EINVAL;
>  		goto err_put;
>  	}
>  	channel->channel = &indio_dev->channels[index];
> 

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

end of thread, other threads:[~2013-06-04 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <60123fd3175b7cceadf6c335b12e58b797e18f65.1370356776.git.joe@perches.com>
2013-06-04 14:44 ` [PATCH 2/4] inkern: iio_device_put after incorrect return/goto Joe Perches
2013-06-04 17:28   ` 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).