[PATCH 07/14] staging: comedi: serial2002: don't assume the number of subdevices to detach

H Hartley Sweeten hsweeten at visionengravers.com
Fri Apr 5 23:10:01 UTC 2013


Use the number of subdevices allocated (dev->n_subdevices) in the
(*detach) instead of assuming a given number.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfondation.org>
---
 drivers/staging/comedi/drivers/serial2002.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index e3243f8..2250ac6 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -811,7 +811,7 @@ static void serial2002_detach(struct comedi_device *dev)
 	struct comedi_subdevice *s;
 	int i;
 
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < dev->n_subdevices; i++) {
 		s = &dev->subdevices[i];
 		kfree(s->maxdata_list);
 		kfree(s->range_table_list);
-- 
1.8.1.4




More information about the devel mailing list