diff mbox

x86/psr: remove useless check in free_socket_resources

Message ID 20170809123519.22605-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Aug. 9, 2017, 12:35 p.m. UTC
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(-)

Comments

Jan Beulich Aug. 9, 2017, 1:35 p.m. UTC | #1
>>> 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>
diff mbox

Patch

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,