All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: Eliminate an odd local variable
@ 2019-01-21 16:04 Andrii Anisov
  2019-01-22  8:20 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Anisov @ 2019-01-21 16:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrii Anisov, Jan Beulich

From: Andrii Anisov <andrii_anisov@epam.com>

Wipe out excessive lines from an iommu_unmap(), and align it with an
iommu_map() code.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
---
 xen/drivers/passthrough/iommu.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index bd1af35..b31a1a9 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -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) )
         {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: Eliminate an odd local variable
  2019-01-21 16:04 [PATCH] iommu: Eliminate an odd local variable Andrii Anisov
@ 2019-01-22  8:20 ` Jan Beulich
  2019-01-22  9:20   ` Andrii Anisov
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2019-01-22  8:20 UTC (permalink / raw)
  To: andrii.anisov; +Cc: xen-devel, andrii_anisov

>>> On 21.01.19 at 17:04, <andrii.anisov@gmail.com> wrote:
> Wipe out excessive lines from an iommu_unmap(), and align it with an
> iommu_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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: Eliminate an odd local variable
  2019-01-22  8:20 ` Jan Beulich
@ 2019-01-22  9:20   ` Andrii Anisov
  0 siblings, 0 replies; 3+ messages in thread
From: Andrii Anisov @ 2019-01-22  9:20 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, andrii_anisov

Hello Jan,

On 22.01.19 10:20, Jan Beulich wrote:
> 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.

-- 
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-22  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 16:04 [PATCH] iommu: Eliminate an odd local variable Andrii Anisov
2019-01-22  8:20 ` Jan Beulich
2019-01-22  9:20   ` Andrii Anisov

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.