All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/psr: remove useless check in free_socket_resources
@ 2017-08-09 12:35 Wei Liu
  2017-08-09 13:35 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2017-08-09 12:35 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, yi.y.sun, Wei Liu, Jan Beulich

The check is useless because pointer arithmetic ensures "info" is
always non-zero.

Replace it with an ASSERT for socket_info. The only caller of
free_socket_resources already ensures socket_info is not NULL before
calling it.

Coverity-ID: 1416344

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/psr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 9ce8f17a18..84f213ccf6 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -195,8 +195,7 @@ static void free_socket_resources(unsigned int socket)
     unsigned int i;
     struct psr_socket_info *info = socket_info + socket;
 
-    if ( !info )
-        return;
+    ASSERT(socket_info);
 
     /*
      * Free resources of features. The global feature object, e.g. feat_l3,
-- 
2.11.0


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

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

* Re: [PATCH] x86/psr: remove useless check in free_socket_resources
  2017-08-09 12:35 [PATCH] x86/psr: remove useless check in free_socket_resources Wei Liu
@ 2017-08-09 13:35 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2017-08-09 13:35 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, yi.y.sun, Xen-devel

>>> On 09.08.17 at 14:35, <wei.liu2@citrix.com> wrote:
> The check is useless because pointer arithmetic ensures "info" is
> always non-zero.
> 
> Replace it with an ASSERT for socket_info. The only caller of
> free_socket_resources already ensures socket_info is not NULL before
> calling it.
> 
> Coverity-ID: 1416344
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



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

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

end of thread, other threads:[~2017-08-09 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09 12:35 [PATCH] x86/psr: remove useless check in free_socket_resources Wei Liu
2017-08-09 13:35 ` Jan Beulich

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.