* [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
@ 2012-07-01 13:42 Devendra Naga
2012-07-01 15:32 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Devendra Naga @ 2012-07-01 13:42 UTC (permalink / raw)
To: Ian Abbott, Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten,
devel, linux-kernel
Cc: Devendra Naga
as comedi_alloc_subdevices may fail, we leak out the memory allocated by alloc_private,
and also the I/O regions we requested.
free out the private data pointer of the driver, and release the I/O regions.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
drivers/staging/comedi/drivers/fl512.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c
index 52e6d14..ad64b32 100644
--- a/drivers/staging/comedi/drivers/fl512.c
+++ b/drivers/staging/comedi/drivers/fl512.c
@@ -135,8 +135,11 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif
ret = comedi_alloc_subdevices(dev, 2);
- if (ret)
+ if (ret) {
+ kfree(dev->priv);
+ release_region(iobase, FL512_SIZE);
return ret;
+ }
/*
* this if the definitions of the supdevices, 2 have been defined
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
2012-07-01 13:42 [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices Devendra Naga
@ 2012-07-01 15:32 ` Dan Carpenter
2012-07-01 16:06 ` devendra.aaru
2012-07-02 8:54 ` Ian Abbott
0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2012-07-01 15:32 UTC (permalink / raw)
To: Devendra Naga
Cc: Ian Abbott, Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten,
devel, linux-kernel
On Sun, Jul 01, 2012 at 07:12:07PM +0530, Devendra Naga wrote:
> as comedi_alloc_subdevices may fail, we leak out the memory allocated by alloc_private,
> and also the I/O regions we requested.
>
> free out the private data pointer of the driver, and release the I/O regions.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
This breaks the build.
Also Hartley and Ian, what's the point of alloc_private()? It's
just hiding stuff which we need to know about and use later on
anyway.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
2012-07-01 15:32 ` Dan Carpenter
@ 2012-07-01 16:06 ` devendra.aaru
2012-07-01 16:08 ` devendra.aaru
2012-07-02 8:54 ` Ian Abbott
1 sibling, 1 reply; 5+ messages in thread
From: devendra.aaru @ 2012-07-01 16:06 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ian Abbott, Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten,
devel, linux-kernel
Hi Dan,
On Sun, Jul 1, 2012 at 9:02 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Sun, Jul 01, 2012 at 07:12:07PM +0530, Devendra Naga wrote:
>> as comedi_alloc_subdevices may fail, we leak out the memory allocated by alloc_private,
>> and also the I/O regions we requested.
>>
>> free out the private data pointer of the driver, and release the I/O regions.
>>
>> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
>
> This breaks the build.
dev->priv should be dev->private. I was in a hurry to send the fix and
didn't build tested,
>
> Also Hartley and Ian, what's the point of alloc_private()? It's
> just hiding stuff which we need to know about and use later on
> anyway.
>
> regards,
> dan carpenter
>
>
sorry again,
Devendra.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
2012-07-01 16:06 ` devendra.aaru
@ 2012-07-01 16:08 ` devendra.aaru
0 siblings, 0 replies; 5+ messages in thread
From: devendra.aaru @ 2012-07-01 16:08 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ian Abbott, Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten,
devel, linux-kernel
Hi,
Dropping the patch 2/2 and its V2 also because of build breakage,
sending V3 in a few minutes.
Patch 1/2 is fine though.
Thanks,
Devendra
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
2012-07-01 15:32 ` Dan Carpenter
2012-07-01 16:06 ` devendra.aaru
@ 2012-07-02 8:54 ` Ian Abbott
1 sibling, 0 replies; 5+ messages in thread
From: Ian Abbott @ 2012-07-02 8:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: Devendra Naga, Ian Abbott, Mori Hess, Greg Kroah-Hartman,
H Hartley Sweeten, devel, linux-kernel
On 2012-07-01 16:32, Dan Carpenter wrote:
> On Sun, Jul 01, 2012 at 07:12:07PM +0530, Devendra Naga wrote:
>> as comedi_alloc_subdevices may fail, we leak out the memory allocated by alloc_private,
>> and also the I/O regions we requested.
>>
>> free out the private data pointer of the driver, and release the I/O regions.
>>
>> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
>
> This breaks the build.
>
> Also Hartley and Ian, what's the point of alloc_private()? It's
> just hiding stuff which we need to know about and use later on
> anyway.
Granted, it was more useful before we got kzalloc()!
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-02 8:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-01 13:42 [PATCH V2 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices Devendra Naga
2012-07-01 15:32 ` Dan Carpenter
2012-07-01 16:06 ` devendra.aaru
2012-07-01 16:08 ` devendra.aaru
2012-07-02 8:54 ` Ian Abbott
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.