[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1341149920-12754-1-git-send-email-devendra.aaru@gmail.com>
Date: Sun, 1 Jul 2012 19:08:40 +0530
From: Devendra Naga <devendra.aaru@...il.com>
To: Ian Abbott <abbotti@....co.uk>,
Mori Hess <fmhess@...rs.sourceforge.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
H Hartley Sweeten <hsweeten@...ionengravers.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc: Devendra Naga <devendra.aaru@...il.com>
Subject: [PATCH 2/2] staging/comedi/drivers: free allocated priv and release resources if comedi_alloc_subdevices
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@...il.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..6538497 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);
+ release_region(iobase, FL512_SIZE);
return ret;
+ }
/*
* this if the definitions of the supdevices, 2 have been defined
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists