[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1596431847-1402-1-git-send-email-tangyouling@loongson.cn>
Date:   Mon,  3 Aug 2020 13:17:27 +0800
From:   Youling Tang <tangyouling@...ngson.cn>
To:     Hannes Reinecke <hare@...e.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi/aic7xxx/aicasm: Add missing fclose() call
Add missing fclose() call to close "regdiagfile" in the function stop().
Signed-off-by: Youling Tang <tangyouling@...ngson.cn>
---
 drivers/scsi/aic7xxx/aicasm/aicasm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c
index 5f474e4..a504058 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c
@@ -722,6 +722,15 @@ stop(const char *string, int err_code)
 		}
 	}
 
+	if (regdiagfile != NULL) {
+		fclose(regdiagfile);
+		if (err_code != 0) {
+			fprintf(stderr, "%s: Removing %s due to error\n",
+				appname, regdiagfilename);
+			unlink(regdiagfilename);
+		}
+	}
+
 	symlist_free(&patch_functions);
 	symtable_close();
 
-- 
2.1.0
Powered by blists - more mailing lists
 
