scsi: pmcraid: Add missing resource releases
Most error branches following the call to pmcraid_get_free_cmd contain a call to pmcraid_return_cmd. This patch add these calls where they are missing. Moreover, most error branches following the call to class_create contain a call to class_destroy. This patch add these calls where they are missing. This issue was found with Hector. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Родитель
75b1cc4ad6
Коммит
2d76a2478b
|
@ -3792,11 +3792,11 @@ static long pmcraid_ioctl_passthrough(
|
||||||
direction);
|
direction);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pmcraid_err("couldn't build passthrough ioadls\n");
|
pmcraid_err("couldn't build passthrough ioadls\n");
|
||||||
goto out_free_buffer;
|
goto out_free_cmd;
|
||||||
}
|
}
|
||||||
} else if (request_size < 0) {
|
} else if (request_size < 0) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out_free_buffer;
|
goto out_free_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If data is being written into the device, copy the data from user
|
/* If data is being written into the device, copy the data from user
|
||||||
|
@ -3913,6 +3913,8 @@ out_handle_response:
|
||||||
|
|
||||||
out_free_sglist:
|
out_free_sglist:
|
||||||
pmcraid_release_passthrough_ioadls(cmd, request_size, direction);
|
pmcraid_release_passthrough_ioadls(cmd, request_size, direction);
|
||||||
|
|
||||||
|
out_free_cmd:
|
||||||
pmcraid_return_cmd(cmd);
|
pmcraid_return_cmd(cmd);
|
||||||
|
|
||||||
out_free_buffer:
|
out_free_buffer:
|
||||||
|
@ -6023,8 +6025,10 @@ static int __init pmcraid_init(void)
|
||||||
|
|
||||||
error = pmcraid_netlink_init();
|
error = pmcraid_netlink_init();
|
||||||
|
|
||||||
if (error)
|
if (error) {
|
||||||
|
class_destroy(pmcraid_class);
|
||||||
goto out_unreg_chrdev;
|
goto out_unreg_chrdev;
|
||||||
|
}
|
||||||
|
|
||||||
error = pci_register_driver(&pmcraid_driver);
|
error = pci_register_driver(&pmcraid_driver);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче