From patchwork Wed Aug 9 12:35:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9890601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 370FA60384 for ; Wed, 9 Aug 2017 12:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271E028A64 for ; Wed, 9 Aug 2017 12:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B7F128A6F; Wed, 9 Aug 2017 12:37:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B65B428A64 for ; Wed, 9 Aug 2017 12:37:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfQCs-0004xB-Kt; Wed, 09 Aug 2017 12:35:26 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfQCr-0004x5-GN for xen-devel@lists.xenproject.org; Wed, 09 Aug 2017 12:35:25 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 10/B8-27137-C810B895; Wed, 09 Aug 2017 12:35:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRWlGSWpSXmKPExsXitHRDpG4PY3e kwdHzohbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bsw//YC/azVXTO2cfSwLiStYuRk0NCwF/i 2uarTCA2m4CyxM/OXjYQW0RAT6LpwHPGLkYuDmaBbkaJif17wRqEBdwl5mxYyAhiswioSFxZ1 Q8W5xWwkPi+dz7UUHmJXW0XwWwhAQWJjunHmCBqBCVOznzCAmIzC0hIHHzxgnkCI/csJKlZSF ILGJlWMaoXpxaVpRbpGuslFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgQGAwMQ7GD s+Od0iFGSg0lJlHeTdmekEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQleJ4buSCHBotT01Iq0zBxg WMKkJTh4lER4Y/53RQrxFhck5hZnpkOkTjEaczR92PKFiePVhP/fmIRY8vLzUqXEedNAJgmAl GaU5sENgsXLJUZZKWFeRqDThHgKUotyM0tQ5V8xinMwKgnz/gNZyJOZVwK37xXQKUxAp0T4do KcUpKIkJJqYEw5KXGYU2pXriFT/oXJM3q1TF8ayj9k3/jmyKuIZflaatbHpwReCmacmVLF17h OUMgjqynTynDNgxl/KndpH9RJdDqz09Y0acWBGLuJrpYHtrkbK/2/snfV7A//E9y4zkjrrzlV 6cI+z63sWkPdBg2T0GkfCw3m1kyXL/DJmGjIbSPu4bhFSYmlOCPRUIu5qDgRAP+2q3WSAgAA X-Env-Sender: prvs=387dc733a=wei.liu2@citrix.com X-Msg-Ref: server-12.tower-27.messagelabs.com!1502282122!109583499!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57379 invoked from network); 9 Aug 2017 12:35:24 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 9 Aug 2017 12:35:24 -0000 X-IronPort-AV: E=Sophos;i="5.41,347,1498521600"; d="scan'208";a="434848760" From: Wei Liu To: Xen-devel Date: Wed, 9 Aug 2017 13:35:19 +0100 Message-ID: <20170809123519.22605-1-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Andrew Cooper , yi.y.sun@linux.intel.com, Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH] x86/psr: remove useless check in free_socket_resources X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Jan Beulich --- 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,