[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1310946958-13416-1-git-send-email-rajanaresh89@gmail.com>
Date: Sun, 17 Jul 2011 19:55:58 -0400
From: Raja Naresh <rajanaresh89@...il.com>
To: gregkh@...e.de
Cc: martyn.welch@...com, tglx@...utronix.de,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Raja Naresh <rajanaresh89@...il.com>
Subject: [PATCH] staging: vme_user: fix bugs in vme_user_probe
Signed-off-by: Raja Naresh <rajanaresh89@...il.com>
---
drivers/staging/vme/devices/vme_user.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index a571173..0929c33 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -736,7 +736,7 @@ static int __devinit vme_user_probe(struct device *dev, int cur_bus,
image[i].pci_buf = 0;
vme_slave_free(image[i].resource);
err = -ENOMEM;
- goto err_slave;
+ goto err_slave_alloc;
}
}
@@ -803,13 +803,10 @@ static int __devinit vme_user_probe(struct device *dev, int cur_bus,
return 0;
- /* Ensure counter set correcty to destroy all sysfs devices */
- i = VME_DEVS;
err_sysfs:
- while (i > 0) {
- i--;
+ while (--i >= 0)
device_destroy(vme_user_sysfs_class, MKDEV(VME_MAJOR, i));
- }
+
class_destroy(vme_user_sysfs_class);
/* Ensure counter set correcty to unalloc all master windows */
@@ -818,18 +815,17 @@ err_master_buf:
for (i = MASTER_MINOR; i < (MASTER_MAX + 1); i++)
kfree(image[i].kern_buf);
err_master:
- while (i > MASTER_MINOR) {
- i--;
+ while (--i >= MASTER_MINOR)
vme_master_free(image[i].resource);
- }
-
- /*
+ /*
* Ensure counter set correcty to unalloc all slave windows and buffers
*/
i = SLAVE_MAX + 1;
+err_slave_alloc:
+ if (i != (SLAVE_MAX + 1))
+ vme_slave_free(image[i].resource);
err_slave:
- while (i > SLAVE_MINOR) {
- i--;
+ while (--i >= SLAVE_MINOR) {
buf_unalloc(i);
vme_slave_free(image[i].resource);
}
--
1.6.3.3
--
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