diff mbox

[1/2] x86: remove redundant checks in sysctl.c

Message ID 1504166846-3871-1-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun Aug. 31, 2017, 8:07 a.m. UTC
In sysctl.c, the return value of 'psr_get_info' has been checked immediately.
So, it is redundant to check the return value again when copy the field to
guest.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
 xen/arch/x86/sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich Aug. 31, 2017, 8:48 a.m. UTC | #1
>>> On 31.08.17 at 10:07, <yi.y.sun@linux.intel.com> wrote:
> In sysctl.c, the return value of 'psr_get_info' has been checked immediately.
> So, it is redundant to check the return value again when copy the field to
> guest.
> 

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>

> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Roger Pau Monné Aug. 31, 2017, 8:59 a.m. UTC | #2
On Thu, Aug 31, 2017 at 04:07:26PM +0800, Yi Sun wrote:
> In sysctl.c, the return value of 'psr_get_info' has been checked immediately.
> So, it is redundant to check the return value again when copy the field to
> guest.
> 
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>

Thanks!

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

BTW, the subject line says 1/2, but I cannot find 2/2, is that just a
glitch?

Roger.
Yi Sun Aug. 31, 2017, 9:27 a.m. UTC | #3
On 17-08-31 09:59:46, Roger Pau Monn� wrote:
> On Thu, Aug 31, 2017 at 04:07:26PM +0800, Yi Sun wrote:
> > In sysctl.c, the return value of 'psr_get_info' has been checked immediately.
> > So, it is redundant to check the return value again when copy the field to
> > guest.
> > 
> > Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
> 
> Thanks!
> 
> Reviewed-by: Roger Pau Monn? <roger.pau@citrix.com>
> 
> BTW, the subject line says 1/2, but I cannot find 2/2, is that just a
> glitch?
> 
Oh, sorry, I just executed 'format-patch -2' to create 2 fix patches. But I
sent them out one by one. I see you have found the second one. :)

> Roger.
diff mbox

Patch

diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 2bde99c..c3fdae8 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -190,7 +190,7 @@  long arch_do_sysctl(
             sysctl->u.psr_cat_op.u.cat_info.flags =
                                       data[PSR_INFO_IDX_CAT_FLAG];
 
-            if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
+            if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
                 ret = -EFAULT;
             break;
         }
@@ -209,7 +209,7 @@  long arch_do_sysctl(
             sysctl->u.psr_cat_op.u.cat_info.flags =
                                       data[PSR_INFO_IDX_CAT_FLAG];
 
-            if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
+            if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
                 ret = -EFAULT;
             break;
         }