From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551AbeCMRRA (ORCPT ); Tue, 13 Mar 2018 13:17:00 -0400 Received: from mga11.intel.com ([192.55.52.93]:26462 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136AbeCMRQ5 (ORCPT ); Tue, 13 Mar 2018 13:16:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,465,1515484800"; d="scan'208";a="207843765" Subject: Re: [PATCH 1/1] x86/platform/x86: Fix count of CHas on multi-pci-segment arches To: Andy Shevchenko Cc: "Kroening, Gary" , "mingo@redhat.com" , "hpa@zytor.com" , "tglx@linutronix.de" , "peterz@infradead.org" , "Travis, Mike" , "Banman, Andrew" , "Sivanich, Dimitri" , "Anderson, Russ" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <9efcdfa1-9da3-f4de-749f-0950d20a5758@linux.intel.com> From: "Liang, Kan" Message-ID: <55123ef5-3287-d4c9-4499-62140c598474@linux.intel.com> Date: Tue, 13 Mar 2018 13:16:54 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/13/2018 11:58 AM, Andy Shevchenko wrote: > On Tue, Mar 13, 2018 at 3:42 AM, Liang, Kan wrote: > >> +#define SKX_CAPID6 0x9c >> +#define SKX_CHA_BIT_WIDTH 28 >> + >> static int skx_count_chabox(void) >> { >> + struct pci_dev *dev = NULL; >> + u32 val = 0; >> > >> + dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2083, dev); >> + if (!dev) >> + return 0; > > Where is pci_dev_put()? > >> >> + pci_read_config_dword(dev, SKX_CAPID6, &val); >> + return bitmap_weight((unsigned long *)&val, SKX_CHA_BIT_WIDTH); > > UB is here. > Fix is simple, use unsigned long and drop this ugly casting. > Thanks. I will fix them in V2. Thanks, Kan