lkml.org 
[lkml]   [2012]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V3 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
Date
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..1c372d1 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->private);
+ release_region(iobase, FL512_SIZE);
return ret;
+ }

/*
* this if the definitions of the supdevices, 2 have been defined
--
1.7.9.5


\
 
 \ /
  Last update: 2012-07-01 19:01    [W:0.042 / U:2.848 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site