From: Raja Naresh <rajanaresh89@gmail.com>
To: gregkh@suse.de
Cc: martyn.welch@ge.com, tglx@linutronix.de,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Raja Naresh <rajanaresh89@gmail.com>
Subject: [PATCH] staging: vme_user: fix bugs in vme_user_probe
Date: Sun, 17 Jul 2011 19:55:58 -0400 [thread overview]
Message-ID: <1310946958-13416-1-git-send-email-rajanaresh89@gmail.com> (raw)
Signed-off-by: Raja Naresh <rajanaresh89@gmail.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
next reply other threads:[~2011-07-17 23:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-17 23:55 Raja Naresh [this message]
2011-07-18 20:30 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310946958-13416-1-git-send-email-rajanaresh89@gmail.com \
--to=rajanaresh89@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=martyn.welch@ge.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®