Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
35d10809
Commit
35d10809
authored
Feb 20, 2003
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] handles possible failures in scsi initialization
.. and unwind properly to avoid leaks
parent
3d34f2f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
29 deletions
+59
-29
drivers/scsi/scsi.c
drivers/scsi/scsi.c
+59
-29
No files found.
drivers/scsi/scsi.c
View file @
35d10809
...
@@ -1147,29 +1147,6 @@ int scsi_dev_info_list_add_str (char *dev_list)
...
@@ -1147,29 +1147,6 @@ int scsi_dev_info_list_add_str (char *dev_list)
return
res
;
return
res
;
}
}
/**
* scsi_dev_list_init: set up the dynamic device list.
* @dev_list: string of device flags to add
*
* Description:
* Add command line @dev_list entries, then add
* scsi_static_device_list entries to the scsi device info list.
**/
static
void
scsi_dev_info_list_init
(
char
*
dev_list
)
{
int
i
;
if
(
scsi_dev_info_list_add_str
(
dev_list
)
==
-
ENOMEM
)
return
;
for
(
i
=
0
;
scsi_static_device_list
[
i
].
vendor
!=
NULL
;
i
++
)
if
(
scsi_dev_info_list_add
(
1
/* compatibile */
,
scsi_static_device_list
[
i
].
vendor
,
scsi_static_device_list
[
i
].
model
,
NULL
,
scsi_static_device_list
[
i
].
flags
)
==
-
ENOMEM
)
return
;
}
/**
/**
* scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove
* scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove
* the scsi_dev_info_list.
* the scsi_dev_info_list.
...
@@ -1186,6 +1163,37 @@ static void scsi_dev_info_list_delete (void)
...
@@ -1186,6 +1163,37 @@ static void scsi_dev_info_list_delete (void)
}
}
}
}
/**
* scsi_dev_list_init: set up the dynamic device list.
* @dev_list: string of device flags to add
*
* Description:
* Add command line @dev_list entries, then add
* scsi_static_device_list entries to the scsi device info list.
**/
static
int
scsi_dev_info_list_init
(
char
*
dev_list
)
{
int
error
,
i
;
error
=
scsi_dev_info_list_add_str
(
dev_list
);
if
(
error
)
return
error
;
for
(
i
=
0
;
scsi_static_device_list
[
i
].
vendor
!=
NULL
;
i
++
)
{
error
=
scsi_dev_info_list_add
(
1
/* compatibile */
,
scsi_static_device_list
[
i
].
vendor
,
scsi_static_device_list
[
i
].
model
,
NULL
,
scsi_static_device_list
[
i
].
flags
);
if
(
error
)
break
;
}
if
(
error
)
scsi_dev_info_list_delete
();
return
error
;
}
/**
/**
* get_device_flags - get device specific flags from the dynamic device
* get_device_flags - get device specific flags from the dynamic device
* list. Called during scan time.
* list. Called during scan time.
...
@@ -1437,17 +1445,39 @@ __setup("scsi_default_dev_flags=", setup_scsi_default_dev_flags);
...
@@ -1437,17 +1445,39 @@ __setup("scsi_default_dev_flags=", setup_scsi_default_dev_flags);
#endif
#endif
/* FIXME(hch): add proper error handling */
static
int
__init
init_scsi
(
void
)
static
int
__init
init_scsi
(
void
)
{
{
scsi_init_queue
();
int
error
;
scsi_init_procfs
();
devfs_mk_dir
(
NULL
,
"scsi"
,
NULL
);
error
=
scsi_init_queue
();
if
(
error
)
return
error
;
error
=
scsi_init_procfs
();
if
(
error
)
goto
cleanup_queue
;
error
=
-
ENOMEM
;
if
(
!
devfs_mk_dir
(
NULL
,
"scsi"
,
NULL
))
goto
cleanup_procfs
;
error
=
scsi_dev_info_list_init
(
scsi_dev_flags
);
if
(
error
)
goto
cleanup_devfs
;
error
=
scsi_sysfs_register
();
if
(
error
)
goto
cleanup_devlist
;
scsi_host_init
();
scsi_host_init
();
scsi_dev_info_list_init
(
scsi_dev_flags
);
scsi_sysfs_register
();
open_softirq
(
SCSI_SOFTIRQ
,
scsi_softirq
,
NULL
);
open_softirq
(
SCSI_SOFTIRQ
,
scsi_softirq
,
NULL
);
return
0
;
return
0
;
cleanup_devlist:
scsi_dev_info_list_delete
();
cleanup_devfs:
devfs_remove
(
"scsi"
);
cleanup_procfs:
scsi_exit_procfs
();
cleanup_queue:
scsi_exit_queue
();
return
error
;
}
}
static
void
__exit
exit_scsi
(
void
)
static
void
__exit
exit_scsi
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment