Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1006745pxb; Tue, 26 Oct 2021 00:44:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAbQo7JyhU7HaKGYS0pp3m61HWYcM4fs5fy/SisKp2rCjTxbm/8Nrazd7W9xweCFB/eSM/ X-Received: by 2002:a63:5453:: with SMTP id e19mr17714058pgm.178.1635234296536; Tue, 26 Oct 2021 00:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635234296; cv=none; d=google.com; s=arc-20160816; b=zrs47sB71gIGENGbwlR/CwyTFq2Lflkv2LvD6RmcGc8yRWLHydhzgg15cAg3Ftletf nGM66KKdJXMB7t7ZjX6kLjEsNP2bn1Nthdcj+D97zq+Pt/4F3GNUayZuihjSDKY1WfWB OUSptUpxFTJHzafY3rr/XFJFVjY1pEoIo8U9RUGsIZrvbouNrBIpqT+bVF7eLD7pUIjh BoB0xgMuAjIlbFbC/04CAsofHoKiT0jj52Wv1tPJST4tTz6UfPa/0ejPwsiXIVLn6sB+ ixS5mz5pJ/Qjrq+NPRAdDunEJWU2wDG0etZzhZkHPTuxLNiPY59WYsCbs6m9/CiXtnu9 eEmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=IhoPuxnZO811EtcBXD6x458IC9cIQM+lCOoeQfHLaMc=; b=LgPQ3u6BLFmrM9SClBPizgmMzuROlLuK7UG7ZbAinqYjeRbkDYPhXf8Qm2L5y76doX Clv0ITPE9kdlEVDaiX7ydzoNYLGSK8VsXFkTjrb4zBtWAw/SM7Pm0pwNBMZEuv6nPkLv GdIE+7kcPKYNPBgRazvXVPVaWKlt38Psr7a+xe7PnL7It/iGMglKv7pL/AL08qEqvfoV ADC5YHI6sByMqOyLqMqRAZ4lG4D+oMBEWhAEHqXK6Hr2K8hFK1qWYuv6aiS8bCxdSH0O ifMtEeUiTGIhO9XmIAk6vQZ3cBPyEz+BO5iWnXaSEQx+lURIrzLm4t1yoiO95hx1wL8Z 1LuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si30369333pfu.128.2021.10.26.00.44.43; Tue, 26 Oct 2021 00:44:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbhJZHfA (ORCPT + 99 others); Tue, 26 Oct 2021 03:35:00 -0400 Received: from smtp25.cstnet.cn ([159.226.251.25]:34372 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229540AbhJZHe7 (ORCPT ); Tue, 26 Oct 2021 03:34:59 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-05 (Coremail) with SMTP id zQCowADX37_8rndhi+4zBQ--.50197S2; Tue, 26 Oct 2021 15:32:12 +0800 (CST) From: Jiasheng Jiang To: boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v2] xen: Fix implicit type conversion Date: Tue, 26 Oct 2021 07:32:11 +0000 Message-Id: <1635233531-2437704-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: zQCowADX37_8rndhi+4zBQ--.50197S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Kry8CryDZF4DJrW8Ary8AFb_yoW8Xw4Dpa yjk34UAryrGa4qka4fJr4kuFyfGayDCrWxWwnrt39YvFn8ury0qFyfJ34Y9ryDur4rC3WI vrWqvr17GrsxXrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkv14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_GF4l 42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJV WUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAK I48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r 4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUh4SOUUUUU= X-Originating-IP: [124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The variable 'i' is defined as UINT. However in the for_each_possible_cpu, its value is assigned to -1. That doesn't make sense and in the cpumask_next() it is implicitly type conversed to INT. It is universally accepted that the implicit type conversion is terrible. Also, having the good programming custom will set an example for others. Thus, it might be better to change the definition of 'i' from UINT to INT. Fixes: 3fac101 ("xen: Re-upload processor PM data to hypervisor after S3 resume (v2)") Signed-off-by: Jiasheng Jiang --- drivers/xen/xen-acpi-processor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index df7cab8..9cb61db 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c @@ -450,7 +450,7 @@ static struct acpi_processor_performance __percpu *acpi_perf_data; static void free_acpi_perf_data(void) { - unsigned int i; + int i; /* Freeing a NULL pointer is OK, and alloc_percpu zeroes. */ for_each_possible_cpu(i) @@ -462,7 +462,7 @@ static void free_acpi_perf_data(void) static int xen_upload_processor_pm_data(void) { struct acpi_processor *pr_backup = NULL; - unsigned int i; + int i; int rc = 0; pr_info("Uploading Xen processor PM info\n"); @@ -518,7 +518,7 @@ static struct syscore_ops xap_syscore_ops = { static int __init xen_acpi_processor_init(void) { - unsigned int i; + int i; int rc; if (!xen_initial_domain()) -- 2.7.4