summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.c
diff options
context:
space:
mode:
authorQuentin Lambert <lambert.quentin@gmail.com>2016-11-19 18:43:18 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-22 23:04:32 +0100
commit2d76a2478bb8c54d241b23a699d55f90b7efd036 (patch)
treebf5211c46f225ad49b5a26873f9c3b7c6df9f056 /drivers/scsi/pmcraid.c
parentscsi: ufs: introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk (diff)
downloadlinux-2d76a2478bb8c54d241b23a699d55f90b7efd036.tar.xz
linux-2d76a2478bb8c54d241b23a699d55f90b7efd036.zip
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>
Diffstat (limited to 'drivers/scsi/pmcraid.c')
-rw-r--r--drivers/scsi/pmcraid.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 68a5c347fae9..cb12b7bad8e6 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3792,11 +3792,11 @@ static long pmcraid_ioctl_passthrough(
direction);
if (rc) {
pmcraid_err("couldn't build passthrough ioadls\n");
- goto out_free_buffer;
+ goto out_free_cmd;
}
} else if (request_size < 0) {
rc = -EINVAL;
- goto out_free_buffer;
+ goto out_free_cmd;
}
/* If data is being written into the device, copy the data from user
@@ -3913,6 +3913,8 @@ out_handle_response:
out_free_sglist:
pmcraid_release_passthrough_ioadls(cmd, request_size, direction);
+
+out_free_cmd:
pmcraid_return_cmd(cmd);
out_free_buffer:
@@ -6023,8 +6025,10 @@ static int __init pmcraid_init(void)
error = pmcraid_netlink_init();
- if (error)
+ if (error) {
+ class_destroy(pmcraid_class);
goto out_unreg_chrdev;
+ }
error = pci_register_driver(&pmcraid_driver);