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
nexedi
linux
Commits
80e01029
Commit
80e01029
authored
Sep 03, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Sep 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] cciss error handling cleanup
From: mike.miller@hp.com Clean up the error handling in cciss_init_one().
parent
74a93fb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
40 deletions
+32
-40
drivers/block/cciss.c
drivers/block/cciss.c
+32
-40
No files found.
drivers/block/cciss.c
View file @
80e01029
...
...
@@ -2447,11 +2447,8 @@ static int __init cciss_init_one(struct pci_dev *pdev,
if
(
i
<
0
)
return
(
-
1
);
if
(
cciss_pci_init
(
hba
[
i
],
pdev
)
!=
0
)
{
release_io_mem
(
hba
[
i
]);
free_hba
(
i
);
return
(
-
1
);
}
goto
clean1
;
sprintf
(
hba
[
i
]
->
devname
,
"cciss%d"
,
i
);
hba
[
i
]
->
ctlr
=
i
;
hba
[
i
]
->
pdev
=
pdev
;
...
...
@@ -2463,28 +2460,23 @@ static int __init cciss_init_one(struct pci_dev *pdev,
printk
(
"cciss: not using DAC cycles
\n
"
);
else
{
printk
(
"cciss: no suitable DMA available
\n
"
);
free_hba
(
i
);
return
-
ENODEV
;
goto
clean1
;
}
if
(
register_blkdev
(
COMPAQ_CISS_MAJOR
+
i
,
hba
[
i
]
->
devname
))
{
release_io_mem
(
hba
[
i
]);
free_hba
(
i
);
return
-
1
;
printk
(
KERN_ERR
"cciss: Unable to register device %s
\n
"
,
hba
[
i
]
->
devname
);
goto
clean
1
;
}
/* make sure the board interrupts are off */
hba
[
i
]
->
access
.
set_intr_mask
(
hba
[
i
],
CCISS_INTR_OFF
);
if
(
request_irq
(
hba
[
i
]
->
intr
,
do_cciss_intr
,
SA_INTERRUPT
|
SA_SHIRQ
|
SA_SAMPLE_RANDOM
,
hba
[
i
]
->
devname
,
hba
[
i
]))
{
printk
(
KERN_ERR
"ciss: Unable to get irq %d for %s
\n
"
,
hba
[
i
]
->
devname
,
hba
[
i
]))
{
printk
(
KERN_ERR
"cciss: Unable to get irq %d for %s
\n
"
,
hba
[
i
]
->
intr
,
hba
[
i
]
->
devname
);
unregister_blkdev
(
COMPAQ_CISS_MAJOR
+
i
,
hba
[
i
]
->
devname
);
release_io_mem
(
hba
[
i
]);
free_hba
(
i
);
return
(
-
1
);
goto
clean2
;
}
hba
[
i
]
->
cmd_pool_bits
=
kmalloc
(((
NR_CMDS
+
BITS_PER_LONG
-
1
)
/
BITS_PER_LONG
)
*
sizeof
(
unsigned
long
),
GFP_KERNEL
);
hba
[
i
]
->
cmd_pool
=
(
CommandList_struct
*
)
pci_alloc_consistent
(
...
...
@@ -2495,35 +2487,15 @@ static int __init cciss_init_one(struct pci_dev *pdev,
&
(
hba
[
i
]
->
errinfo_pool_dhandle
));
if
((
hba
[
i
]
->
cmd_pool_bits
==
NULL
)
||
(
hba
[
i
]
->
cmd_pool
==
NULL
)
||
(
hba
[
i
]
->
errinfo_pool
==
NULL
))
{
err_all:
if
(
hba
[
i
]
->
cmd_pool_bits
)
kfree
(
hba
[
i
]
->
cmd_pool_bits
);
if
(
hba
[
i
]
->
cmd_pool
)
pci_free_consistent
(
hba
[
i
]
->
pdev
,
NR_CMDS
*
sizeof
(
CommandList_struct
),
hba
[
i
]
->
cmd_pool
,
hba
[
i
]
->
cmd_pool_dhandle
);
if
(
hba
[
i
]
->
errinfo_pool
)
pci_free_consistent
(
hba
[
i
]
->
pdev
,
NR_CMDS
*
sizeof
(
ErrorInfo_struct
),
hba
[
i
]
->
errinfo_pool
,
hba
[
i
]
->
errinfo_pool_dhandle
);
free_irq
(
hba
[
i
]
->
intr
,
hba
[
i
]);
unregister_blkdev
(
COMPAQ_CISS_MAJOR
+
i
,
hba
[
i
]
->
devname
);
release_io_mem
(
hba
[
i
]);
free_hba
(
i
);
||
(
hba
[
i
]
->
errinfo_pool
==
NULL
))
{
printk
(
KERN_ERR
"cciss: out of memory"
);
return
(
-
1
)
;
goto
clean4
;
}
/*
* someone needs to clean up this failure handling mess
*/
spin_lock_init
(
&
hba
[
i
]
->
lock
);
q
=
blk_init_queue
(
do_cciss_request
,
&
hba
[
i
]
->
lock
);
if
(
!
q
)
goto
err_all
;
goto
clean4
;
hba
[
i
]
->
queue
=
q
;
q
->
queuedata
=
hba
[
i
];
...
...
@@ -2576,6 +2548,26 @@ static int __init cciss_init_one(struct pci_dev *pdev,
add_disk
(
disk
);
}
return
(
1
);
clean4:
if
(
hba
[
i
]
->
cmd_pool_bits
)
kfree
(
hba
[
i
]
->
cmd_pool_bits
);
if
(
hba
[
i
]
->
cmd_pool
)
pci_free_consistent
(
hba
[
i
]
->
pdev
,
NR_CMDS
*
sizeof
(
CommandList_struct
),
hba
[
i
]
->
cmd_pool
,
hba
[
i
]
->
cmd_pool_dhandle
);
if
(
hba
[
i
]
->
errinfo_pool
)
pci_free_consistent
(
hba
[
i
]
->
pdev
,
NR_CMDS
*
sizeof
(
ErrorInfo_struct
),
hba
[
i
]
->
errinfo_pool
,
hba
[
i
]
->
errinfo_pool_dhandle
);
free_irq
(
hba
[
i
]
->
intr
,
hba
[
i
]);
clean2:
unregister_blkdev
(
COMPAQ_CISS_MAJOR
+
i
,
hba
[
i
]
->
devname
);
clean1:
release_io_mem
(
hba
[
i
]);
free_hba
(
i
);
return
(
-
1
);
}
static
void
__devexit
cciss_remove_one
(
struct
pci_dev
*
pdev
)
...
...
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