aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/vme/devices/vme_user.c
diff options
context:
space:
mode:
authorArthur Benilov <arthur.benilov@iba-group.com>2010-02-16 15:41:21 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 16:43:02 -0800
commit33e920d9ebaddbc9cf51cf6e1de7baa8d7b8d6dd (patch)
tree1d0b80f40ce283f43cd375acbc6c56fcb241ed6a /drivers/staging/vme/devices/vme_user.c
parent5188d74cc4597a63a0907b8996ca0a2d36f1b970 (diff)
downloadlinaro-lsk-33e920d9ebaddbc9cf51cf6e1de7baa8d7b8d6dd.tar.gz
Staging: vme: Allocate memory buffers for master windows
For VME device I/O operations on master windows the user driver tends to use kern_buf buffer array which is not allocated. This causes an error when reading from master window device files. Signed-off-by: Arthur Benilov <arthur.benilov@iba-group.com> Signed-off-by: Vincent Bossier <vincent.bossier@iba-group.com> Acked-by: Martyn Welch <martyn.welch@ge.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vme/devices/vme_user.c')
-rw-r--r--drivers/staging/vme/devices/vme_user.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 0d404f1a27f..c60c80fb241 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -738,6 +738,14 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot)
"resource\n");
goto err_master;
}
+ image[i].size_buf = PCI_BUF_SIZE;
+ image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
+ if (image[i].kern_buf == NULL) {
+ printk(KERN_WARNING "Unable to allocate memory for "
+ "master window buffers\n");
+ err = -ENOMEM;
+ goto err_master_buf;
+ }
}
/* Create sysfs entries - on udev systems this creates the dev files */
@@ -791,6 +799,9 @@ err_sysfs:
/* Ensure counter set correcty to unalloc all master windows */
i = MASTER_MAX + 1;
+err_master_buf:
+ for (i = MASTER_MINOR; i < (MASTER_MAX + 1); i++)
+ kfree(image[i].kern_buf);
err_master:
while (i > MASTER_MINOR) {
i--;
@@ -826,6 +837,9 @@ static int __exit vme_user_remove(struct device *dev, int cur_bus, int cur_slot)
}
class_destroy(vme_user_sysfs_class);
+ for (i = MASTER_MINOR; i < (MASTER_MAX + 1); i++)
+ kfree(image[i].kern_buf);
+
for (i = SLAVE_MINOR; i < (SLAVE_MAX + 1); i++) {
vme_slave_set(image[i].resource, 0, 0, 0, 0, VME_A32, 0);
vme_slave_free(image[i].resource);