linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: pmcraid: Add missing resource releases
@ 2016-11-19 17:43 Quentin Lambert
  2016-11-22 16:14 ` Tomas Henzl
  2016-11-22 22:03 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Quentin Lambert @ 2016-11-19 17:43 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, kernel-janitors
  Cc: Quentin Lambert

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>

---
 drivers/scsi/pmcraid.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3787,11 +3787,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
@@ -3908,6 +3908,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:
@@ -6018,8 +6020,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);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-22 22:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-19 17:43 [PATCH] scsi: pmcraid: Add missing resource releases Quentin Lambert
2016-11-22 16:14 ` Tomas Henzl
2016-11-22 22:03 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).