From: Ian Abbott <abbotti@mev.co.uk>
To: Devendra Naga <devendra.aaru@gmail.com>
Cc: Ian Abbott <ian.abbott@mev.co.uk>,
Mori Hess <fmhess@users.sourceforge.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
H Hartley Sweeten <hsweeten@visionengravers.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] staging/comedi/drivers: release allocated I/O region if alloc_private fails
Date: Mon, 2 Jul 2012 09:40:50 +0100 [thread overview]
Message-ID: <4FF15E92.3040503@mev.co.uk> (raw)
In-Reply-To: <1341149798-12695-1-git-send-email-devendra.aaru@gmail.com>
On 2012-07-01 14:36, Devendra Naga wrote:
> if alloc_private fail, we wont' release the I/O region,
> which was request_region 'ed.
>
> release the allocated I/O region if alloc_private fails.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> ---
> drivers/staging/comedi/drivers/fl512.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c
> index d1da809..52e6d14 100644
> --- a/drivers/staging/comedi/drivers/fl512.c
> +++ b/drivers/staging/comedi/drivers/fl512.c
> @@ -125,8 +125,10 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
> }
> dev->iobase = iobase;
> dev->board_name = "fl512";
> - if (alloc_private(dev, sizeof(struct fl512_private)) < 0)
> + if (alloc_private(dev, sizeof(struct fl512_private)) < 0) {
> + release_region(iobase, FL512_SIZE);
> return -ENOMEM;
> + }
>
> #if DEBUG
> printk(KERN_DEBUG "malloc ok\n");
No. The I/O region will be deallocated in fl512_detach() because
dev->iobase has been set non-zero. fl512_detach() will be called by the
comedi core if fl512_attach() returns an error. This is an unusual
aspect of the comedi drivers.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
next prev parent reply other threads:[~2012-07-02 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-01 13:36 [PATCH 1/2] staging/comedi/drivers: release allocated I/O region if alloc_private fails Devendra Naga
2012-07-02 8:40 ` Ian Abbott [this message]
2012-07-02 8:43 ` devendra.aaru
2012-07-02 15:57 ` H Hartley Sweeten
2012-07-03 10:18 ` Ian Abbott
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=4FF15E92.3040503@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=devendra.aaru@gmail.com \
--cc=fmhess@users.sourceforge.net \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=ian.abbott@mev.co.uk \
--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