git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[pandora-kernel.git]
/
drivers
/
scsi
/
sg.c
diff --git
a/drivers/scsi/sg.c
b/drivers/scsi/sg.c
index
b098942
..
65eef33
100644
(file)
--- a/
drivers/scsi/sg.c
+++ b/
drivers/scsi/sg.c
@@
-28,7
+28,6
@@
static int sg_version_num = 30533; /* 2 digits for each component */
* (otherwise the macros compile to empty statements).
*
*/
* (otherwise the macros compile to empty statements).
*
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/fs.h>
@@
-1402,6
+1401,7
@@
sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
Sg_device *sdp = NULL;
struct cdev * cdev = NULL;
int error, k;
Sg_device *sdp = NULL;
struct cdev * cdev = NULL;
int error, k;
+ unsigned long iflags;
disk = alloc_disk(1);
if (!disk) {
disk = alloc_disk(1);
if (!disk) {
@@
-1429,7
+1429,7
@@
sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
if (error)
error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
if (error)
- goto
out
;
+ goto
cdev_add_err
;
sdp->cdev = cdev;
if (sg_sysfs_valid) {
sdp->cdev = cdev;
if (sg_sysfs_valid) {
@@
-1456,6
+1456,13
@@
sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
return 0;
return 0;
+cdev_add_err:
+ write_lock_irqsave(&sg_dev_arr_lock, iflags);
+ kfree(sg_dev_arr[k]);
+ sg_dev_arr[k] = NULL;
+ sg_nr_dev--;
+ write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
+
out:
put_disk(disk);
if (cdev)
out:
put_disk(disk);
if (cdev)
@@
-2635,8
+2642,7
@@
static int
sg_proc_init(void)
{
int k, mask;
sg_proc_init(void)
{
int k, mask;
- int num_leaves =
- sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
+ int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
struct proc_dir_entry *pdep;
struct sg_proc_leaf * leaf;
struct proc_dir_entry *pdep;
struct sg_proc_leaf * leaf;
@@
-2661,8
+2667,7
@@
static void
sg_proc_cleanup(void)
{
int k;
sg_proc_cleanup(void)
{
int k;
- int num_leaves =
- sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
+ int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
if (!sg_proc_sgp)
return;
if (!sg_proc_sgp)
return;