diff options
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index eab81c6c0ca5..873e594860d3 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4326,10 +4326,15 @@ clean4: | |||
4326 | for (k = 0; k < hba[i]->nr_cmds; k++) | 4326 | for (k = 0; k < hba[i]->nr_cmds; k++) |
4327 | kfree(hba[i]->scatter_list[k]); | 4327 | kfree(hba[i]->scatter_list[k]); |
4328 | kfree(hba[i]->scatter_list); | 4328 | kfree(hba[i]->scatter_list); |
4329 | for (j = 0; j < hba[i]->nr_cmds; j++) { | 4329 | /* Only free up extra s/g lists if controller supports them */ |
4330 | if (hba[i]->cmd_sg_list[j]) | 4330 | if (hba[i]->chainsize > 0) { |
4331 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | 4331 | for (j = 0; j < hba[i]->nr_cmds; j++) { |
4332 | kfree(hba[i]->cmd_sg_list[j]); | 4332 | if (hba[i]->cmd_sg_list[j]) { |
4333 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | ||
4334 | kfree(hba[i]->cmd_sg_list[j]); | ||
4335 | } | ||
4336 | } | ||
4337 | kfree(hba[i]->cmd_sg_list); | ||
4333 | } | 4338 | } |
4334 | if (hba[i]->cmd_pool) | 4339 | if (hba[i]->cmd_pool) |
4335 | pci_free_consistent(hba[i]->pdev, | 4340 | pci_free_consistent(hba[i]->pdev, |
@@ -4448,9 +4453,15 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
4448 | for (j = 0; j < hba[i]->nr_cmds; j++) | 4453 | for (j = 0; j < hba[i]->nr_cmds; j++) |
4449 | kfree(hba[i]->scatter_list[j]); | 4454 | kfree(hba[i]->scatter_list[j]); |
4450 | kfree(hba[i]->scatter_list); | 4455 | kfree(hba[i]->scatter_list); |
4451 | for (j = 0; j < hba[i]->nr_cmds; j++) { | 4456 | /* Only free up extra s/g lists if controller supports them */ |
4452 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | 4457 | if (hba[i]->chainsize > 0) { |
4453 | kfree(hba[i]->cmd_sg_list[j]); | 4458 | for (j = 0; j < hba[i]->nr_cmds; j++) { |
4459 | if (hba[i]->cmd_sg_list[j]) { | ||
4460 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | ||
4461 | kfree(hba[i]->cmd_sg_list[j]); | ||
4462 | } | ||
4463 | } | ||
4464 | kfree(hba[i]->cmd_sg_list); | ||
4454 | } | 4465 | } |
4455 | /* | 4466 | /* |
4456 | * Deliberately omit pci_disable_device(): it does something nasty to | 4467 | * Deliberately omit pci_disable_device(): it does something nasty to |