All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Megha Dey <megha.dey@linux.intel.com>
Cc: kernel-janitors@vger.kernel.org, iommu@lists.linux-foundation.org
Subject: [PATCH] iommu/vt-d: Unlock on error paths
Date: Thu, 12 Mar 2020 11:37:30 +0000	[thread overview]
Message-ID: <20200312113730.GF20562@mwanda> (raw)

There were a couple places where we need to unlock before returning.

Fixes: 91391b919e19 ("iommu/vt-d: Populate debugfs if IOMMUs are detected")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/iommu/intel-iommu-debugfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c
index 8d24c4d85cc2..6a495b103972 100644
--- a/drivers/iommu/intel-iommu-debugfs.c
+++ b/drivers/iommu/intel-iommu-debugfs.c
@@ -289,11 +289,12 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused)
 		sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
 		if (!(sts & DMA_GSTS_TES)) {
 			seq_puts(m, "DMA Remapping is not enabled\n");
-			return 0;
+			goto unlock;
 		}
 		root_tbl_walk(m, iommu);
 		seq_putc(m, '\n');
 	}
+unlock:
 	rcu_read_unlock();
 
 	return 0;
@@ -444,7 +445,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
 		sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
 		if (!(sts & DMA_GSTS_IRES)) {
 			seq_puts(m, "Interrupt Remapping is not enabled\n");
-			return 0;
+			goto unlock;
 		}
 
 		if (iommu->ir_table) {
@@ -475,6 +476,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
 		}
 		seq_putc(m, '\n');
 	}
+unlock:
 	rcu_read_unlock();
 
 	return 0;
-- 
2.20.1

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Megha Dey <megha.dey@linux.intel.com>
Cc: kernel-janitors@vger.kernel.org, iommu@lists.linux-foundation.org
Subject: [PATCH] iommu/vt-d: Unlock on error paths
Date: Thu, 12 Mar 2020 14:37:30 +0300	[thread overview]
Message-ID: <20200312113730.GF20562@mwanda> (raw)

There were a couple places where we need to unlock before returning.

Fixes: 91391b919e19 ("iommu/vt-d: Populate debugfs if IOMMUs are detected")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/iommu/intel-iommu-debugfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c
index 8d24c4d85cc2..6a495b103972 100644
--- a/drivers/iommu/intel-iommu-debugfs.c
+++ b/drivers/iommu/intel-iommu-debugfs.c
@@ -289,11 +289,12 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused)
 		sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
 		if (!(sts & DMA_GSTS_TES)) {
 			seq_puts(m, "DMA Remapping is not enabled\n");
-			return 0;
+			goto unlock;
 		}
 		root_tbl_walk(m, iommu);
 		seq_putc(m, '\n');
 	}
+unlock:
 	rcu_read_unlock();
 
 	return 0;
@@ -444,7 +445,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
 		sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
 		if (!(sts & DMA_GSTS_IRES)) {
 			seq_puts(m, "Interrupt Remapping is not enabled\n");
-			return 0;
+			goto unlock;
 		}
 
 		if (iommu->ir_table) {
@@ -475,6 +476,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
 		}
 		seq_putc(m, '\n');
 	}
+unlock:
 	rcu_read_unlock();
 
 	return 0;
-- 
2.20.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

             reply	other threads:[~2020-03-12 11:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 11:37 Dan Carpenter [this message]
2020-03-12 11:37 ` [PATCH] iommu/vt-d: Unlock on error paths Dan Carpenter
2020-03-12 12:02 ` Lu Baolu
2020-03-12 12:02   ` Lu Baolu
2020-03-12 12:55   ` Dan Carpenter
2020-03-12 12:55     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200312113730.GF20562@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=megha.dey@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.