From: Dan Carpenter <dan.carpenter@oracle.com>
To: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
driverdev-devel@linuxdriverproject.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/2] staging: iio_simple_dummy: fix init
Date: Wed, 27 May 2015 11:23:02 +0300 [thread overview]
Message-ID: <20150527082302.GN11588@mwanda> (raw)
In-Reply-To: <1432678798-22903-1-git-send-email-rodriguez.twister@gmail.com>
On Wed, May 27, 2015 at 01:19:57AM +0300, Vladimirs Ambrosovs wrote:
> @@ -685,15 +684,14 @@ static int iio_dummy_remove(int index)
> /* Buffered capture related cleanup */
> iio_simple_dummy_unconfigure_buffer(indio_dev);
>
> - ret = iio_simple_dummy_events_unregister(indio_dev);
> - if (ret)
> - goto error_ret;
> + /*
> + * Tidy up interrupt handling
> + * Always returns 0, so not checking for return value
> + */
Even though this is a dummy driver, this comment should be obvious to
everyone. Just leave it out.
> + iio_simple_dummy_events_unregister(indio_dev);
>
> /* Free all structures */
> iio_device_free(indio_dev);
> -
> -error_ret:
> - return ret;
> }
>
> /**
> @@ -722,9 +720,17 @@ static __init int iio_dummy_init(void)
> for (i = 0; i < instances; i++) {
> ret = iio_dummy_probe(i);
> if (ret < 0)
> - return ret;
> + goto error_probe;
> }
> return 0;
> +
> +error_probe:
The label actually removes... It's better to name labels after the
label location instead of the goto location.
> + /* Free devices registered before error */
Leave out the obvious commment.
> + while (i--)
> + iio_dummy_remove(i);
> +
> + kfree(iio_dummy_devs);
> + return ret;
> }
> module_init(iio_dummy_init);
regards,
dan carpenter
prev parent reply other threads:[~2015-05-27 8:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 22:19 [PATCH 1/2] staging: iio_simple_dummy: fix init Vladimirs Ambrosovs
2015-05-26 22:19 ` [PATCH 2/2] staging: iio_simple_dummy: zero check param Vladimirs Ambrosovs
2015-05-27 8:25 ` Dan Carpenter
2015-05-27 22:12 ` Vladimirs Ambrosovs
2015-05-28 6:59 ` Dan Carpenter
2015-05-29 19:38 ` Vladimirs Ambrosovs
2015-05-27 6:21 ` [PATCH 1/2] staging: iio_simple_dummy: fix init Daniel Baluta
2015-05-27 17:24 ` Vladimirs Ambrosovs
2015-05-27 17:29 ` Dan Carpenter
2015-05-28 5:31 ` Daniel Baluta
2015-05-27 8:23 ` Dan Carpenter [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=20150527082302.GN11588@mwanda \
--to=dan.carpenter@oracle.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=rodriguez.twister@gmail.com \
/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 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.