Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753307AbcKSRqn (ORCPT ); Sat, 19 Nov 2016 12:46:43 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32956 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753025AbcKSRql (ORCPT ); Sat, 19 Nov 2016 12:46:41 -0500 From: Quentin Lambert To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: [PATCH] scsi: pmcraid: Add missing resource releases Date: Sat, 19 Nov 2016 18:43:18 +0100 Message-Id: <20161119174318.20394-1-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 53 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 --- 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);