iommu: Eliminate an odd local variable
PATCH 1/1 iommu: Eliminate an odd local variable
From: Andrii Anisov <[email protected]>
Wipe out excessive lines from an iommu_unmap(), and align it with an iommu_map() code.
--- xen/drivers/passthrough/iommu.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
xen/drivers/passthrough/iommu.c +3 -6
@@ -385,19 +385,16 @@ int iommu_unmap(struct domain *d, dfn_t dfn, unsigned int page_order,for ( i =0 ; i < (1ul << page_order); i++ ) { -int err = hd->platform_ops->unmap_page (d,dfn_add (dfn, i), + rc = hd->platform_ops->unmap_page (d,dfn_add (dfn, i), flush_flags); -if (likely (!err) ) +if (likely (!rc) )continue ;if ( !d->is_shutting_down &&printk_ratelimit () )printk (XENLOG_ERR "d%d: IOMMU unmapping dfn %" PRI_dfn" failed: %d\n" , - d->domain_id,dfn_x (dfn_add (dfn, i)), err); - -if ( !rc ) - rc = err; + d->domain_id,dfn_x (dfn_add (dfn, i)), rc);if ( !is_hardware_domain (d) ) {
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 21.01.19 at 17:04, <[email protected]> wrote:
Wipe out excessive lines from an
iommu_unmap(), and align it with aniommu_map()code.
What's excessive there? How come you alter the function's return value without saying why? The more that you make it potentially return success when there was an error.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello Jan,
Quoted 3 lines · Jan Beulich
What's excessive there? How come you alter the function's return value without saying why? The more that you make it potentially return success when there was an error.
Ah, I've realized the difference. In unmap, for hardware domain, we will iterate through pages even if some page failed to unmap, preserving the first caught error. So my patch is wrong.
Sorry for disturbing.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel