All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 12/33] TCMU PR: add a function to free tcmu_pr_info
@ 2018-06-15 18:23 Zhu Lingshan
  0 siblings, 0 replies; only message in thread
From: Zhu Lingshan @ 2018-06-15 18:23 UTC (permalink / raw)
  To: target-devel

This patch added a function tcmu_pr_info_free() which can
help free struct tcmu_pr_info.

Signed-off-by: Zhu Lingshan <lszhu@suse.com>
---
 drivers/target/target_core_user.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 55f1ba98a688..09a4f97243b8 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -2131,6 +2131,20 @@ static int tcmu_pr_info_reg_encode(char *buf, size_t buf_remain,
 	return rc;
 }
 
+static void
+tcmu_pr_info_free(struct tcmu_pr_info *pr_info)
+{
+	struct tcmu_pr_reg *reg;
+	struct tcmu_pr_reg *reg_n;
+
+	kfree(pr_info->scsi2_rsv);
+	kfree(pr_info->rsv);
+	list_for_each_entry_safe(reg, reg_n, &pr_info->regs, regs_node) {
+		kfree(reg);
+	}
+	kfree(pr_info);
+}
+
 static int tcmu_configure_device(struct se_device *dev)
 {
 	struct tcmu_dev *udev = TCMU_DEV(dev);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-15 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15 18:23 [PATCH 12/33] TCMU PR: add a function to free tcmu_pr_info Zhu Lingshan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.