aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 98b9312ba8da..34f9343ed0af 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -18,8 +18,8 @@
18 * 18 *
19 */ 19 */
20 20
21static int sg_version_num = 30533; /* 2 digits for each component */ 21static int sg_version_num = 30534; /* 2 digits for each component */
22#define SG_VERSION_STR "3.5.33" 22#define SG_VERSION_STR "3.5.34"
23 23
24/* 24/*
25 * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes: 25 * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
@@ -28,7 +28,6 @@ static int sg_version_num = 30533; /* 2 digits for each component */
28 * (otherwise the macros compile to empty statements). 28 * (otherwise the macros compile to empty statements).
29 * 29 *
30 */ 30 */
31#include <linux/config.h>
32#include <linux/module.h> 31#include <linux/module.h>
33 32
34#include <linux/fs.h> 33#include <linux/fs.h>
@@ -61,7 +60,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
61 60
62#ifdef CONFIG_SCSI_PROC_FS 61#ifdef CONFIG_SCSI_PROC_FS
63#include <linux/proc_fs.h> 62#include <linux/proc_fs.h>
64static char *sg_version_date = "20050908"; 63static char *sg_version_date = "20060818";
65 64
66static int sg_proc_init(void); 65static int sg_proc_init(void);
67static void sg_proc_cleanup(void); 66static void sg_proc_cleanup(void);
@@ -1165,7 +1164,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
1165 len = vma->vm_end - sa; 1164 len = vma->vm_end - sa;
1166 len = (len < sg->length) ? len : sg->length; 1165 len = (len < sg->length) ? len : sg->length;
1167 if (offset < len) { 1166 if (offset < len) {
1168 page = sg->page; 1167 page = virt_to_page(page_address(sg->page) + offset);
1169 get_page(page); /* increment page count */ 1168 get_page(page); /* increment page count */
1170 break; 1169 break;
1171 } 1170 }
@@ -1402,6 +1401,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1402 Sg_device *sdp = NULL; 1401 Sg_device *sdp = NULL;
1403 struct cdev * cdev = NULL; 1402 struct cdev * cdev = NULL;
1404 int error, k; 1403 int error, k;
1404 unsigned long iflags;
1405 1405
1406 disk = alloc_disk(1); 1406 disk = alloc_disk(1);
1407 if (!disk) { 1407 if (!disk) {
@@ -1429,7 +1429,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1429 1429
1430 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1); 1430 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
1431 if (error) 1431 if (error)
1432 goto out; 1432 goto cdev_add_err;
1433 1433
1434 sdp->cdev = cdev; 1434 sdp->cdev = cdev;
1435 if (sg_sysfs_valid) { 1435 if (sg_sysfs_valid) {
@@ -1456,6 +1456,13 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1456 1456
1457 return 0; 1457 return 0;
1458 1458
1459cdev_add_err:
1460 write_lock_irqsave(&sg_dev_arr_lock, iflags);
1461 kfree(sg_dev_arr[k]);
1462 sg_dev_arr[k] = NULL;
1463 sg_nr_dev--;
1464 write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
1465
1459out: 1466out:
1460 put_disk(disk); 1467 put_disk(disk);
1461 if (cdev) 1468 if (cdev)