From: Artem Mygaiev <joculator@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Artem Mygaiev <artem_mygaiev@epam.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Artem Mygaiev <joculator@gmail.com>
Subject: [Xen-devel] [PATCH 3/3] Free allocated resource on error
Date: Wed, 9 Oct 2019 17:20:17 +0300 [thread overview]
Message-ID: <6575cd1b9c82f5b28cd29d78308dc23821c9d246.1570628924.git.artem_mygaiev@epam.com> (raw)
In-Reply-To: <cover.1570628924.git.artem_mygaiev@epam.com>
Also do not set mark device as SMMU protected when there are no more
SMMU resources left
Coverity-ID: 1381862
Signed-off-by: Artem Mygaiev <artem_mygaiev@epam.com>
---
xen/drivers/passthrough/arm/smmu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index f151b9f5b5..cf42335eed 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -804,9 +804,6 @@ static int register_smmu_master(struct arm_smmu_device *smmu,
master->of_node = masterspec->np;
master->cfg.num_streamids = masterspec->args_count;
- /* Xen: Let Xen know that the device is protected by an SMMU */
- dt_device_set_protected(masterspec->np);
-
for (i = 0; i < master->cfg.num_streamids; ++i) {
u16 streamid = masterspec->args[i];
@@ -815,10 +812,15 @@ static int register_smmu_master(struct arm_smmu_device *smmu,
dev_err(dev,
"stream ID for master device %s greater than maximum allowed (%d)\n",
masterspec->np->name, smmu->num_mapping_groups);
+ devm_free(master);
return -ERANGE;
}
master->cfg.streamids[i] = streamid;
}
+
+ /* Xen: Let Xen know that the device is protected by an SMMU */
+ dt_device_set_protected(masterspec->np);
+
return insert_smmu_master(smmu, master);
}
--
2.20.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-10-09 14:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 14:20 [Xen-devel] [PATCH 0/3] Minor Coverity fixes Artem Mygaiev
2019-10-09 14:20 ` [Xen-devel] [PATCH 1/3] Consistent use for lock variable Artem Mygaiev
2020-01-18 13:09 ` Julien Grall
2019-10-09 14:20 ` [Xen-devel] [PATCH 2/3] Remove useless ASSERT condition Artem Mygaiev
2019-10-09 14:56 ` Julien Grall
2020-01-18 12:58 ` Julien Grall
2019-10-09 14:20 ` Artem Mygaiev [this message]
2019-10-09 15:24 ` [Xen-devel] [PATCH 3/3] Free allocated resource on error Julien Grall
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=6575cd1b9c82f5b28cd29d78308dc23821c9d246.1570628924.git.artem_mygaiev@epam.com \
--to=joculator@gmail.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=artem_mygaiev@epam.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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 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).