Skip to contentSkip to conversation

staging: vme_user: fix bugs in vme_user_probe

PATCH In review Raja Naresh 2 participants 2 messages Jul 17, 2011 – Jul 19, 2011 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vme_user: fix bugs in vme_user_probe

---
 drivers/staging/vme/devices/vme_user.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
drivers/staging/vme/devices/vme_user.c +9 -13
index a571173..0929c33 100644
@@ -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);
 	}
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 1 line · Raja Naresh

What specific bugs are these?

You need to be a lot more descriptive as to what is happening in your patch in order for it to be able to be applied.

Care to redo it and resend it?

thanks,

greg k-h