diff options
author | Steve French <sfrench@us.ibm.com> | 2005-08-30 14:33:26 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-08-30 14:33:26 -0400 |
commit | 2016ef789a9ded2e169ad1c028ae3deb5302571f (patch) | |
tree | 601359f15b42d4d9868b4eadfe909a7bef6435c5 /drivers/scsi/sg.c | |
parent | 7f57356b70dda014ef269135942426e4a852023e (diff) | |
parent | 6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 51292f269ce5..e822ca0e97cf 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -2971,23 +2971,22 @@ static void * dev_seq_start(struct seq_file *s, loff_t *pos) | |||
2971 | { | 2971 | { |
2972 | struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL); | 2972 | struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL); |
2973 | 2973 | ||
2974 | s->private = it; | ||
2974 | if (! it) | 2975 | if (! it) |
2975 | return NULL; | 2976 | return NULL; |
2977 | |||
2976 | if (NULL == sg_dev_arr) | 2978 | if (NULL == sg_dev_arr) |
2977 | goto err1; | 2979 | return NULL; |
2978 | it->index = *pos; | 2980 | it->index = *pos; |
2979 | it->max = sg_last_dev(); | 2981 | it->max = sg_last_dev(); |
2980 | if (it->index >= it->max) | 2982 | if (it->index >= it->max) |
2981 | goto err1; | 2983 | return NULL; |
2982 | return it; | 2984 | return it; |
2983 | err1: | ||
2984 | kfree(it); | ||
2985 | return NULL; | ||
2986 | } | 2985 | } |
2987 | 2986 | ||
2988 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos) | 2987 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos) |
2989 | { | 2988 | { |
2990 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; | 2989 | struct sg_proc_deviter * it = s->private; |
2991 | 2990 | ||
2992 | *pos = ++it->index; | 2991 | *pos = ++it->index; |
2993 | return (it->index < it->max) ? it : NULL; | 2992 | return (it->index < it->max) ? it : NULL; |
@@ -2995,7 +2994,7 @@ static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
2995 | 2994 | ||
2996 | static void dev_seq_stop(struct seq_file *s, void *v) | 2995 | static void dev_seq_stop(struct seq_file *s, void *v) |
2997 | { | 2996 | { |
2998 | kfree (v); | 2997 | kfree(s->private); |
2999 | } | 2998 | } |
3000 | 2999 | ||
3001 | static int sg_proc_open_dev(struct inode *inode, struct file *file) | 3000 | static int sg_proc_open_dev(struct inode *inode, struct file *file) |