From patchwork Tue Jul 5 02:25:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Li X-Patchwork-Id: 587647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E1FC433EF for ; Tue, 5 Jul 2022 02:26:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbiGEC0C (ORCPT ); Mon, 4 Jul 2022 22:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbiGEC0C (ORCPT ); Mon, 4 Jul 2022 22:26:02 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F94E5F; Mon, 4 Jul 2022 19:26:01 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R211e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046060; MF=yang.lee@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0VIPhdNS_1656987958; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0VIPhdNS_1656987958) by smtp.aliyun-inc.com; Tue, 05 Jul 2022 10:25:59 +0800 From: Yang Li To: rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH -next] powercap: arm_scmi: Fix an ignored error return from num_domains_get() Date: Tue, 5 Jul 2022 10:25:57 +0800 Message-Id: <20220705022557.19747-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On line 428 pr->num_zones = powercap_ops->num_domains_get(), the return of num_domains_get() is int, it can be a negative error code, however this is being assigned to an unsigned int variable, so make the num_zones to int to solve this problem without affecting other functions. Eliminate the following coccicheck warning: ./drivers/powercap/arm_scmi_powercap.c:429:5-18: WARNING: Unsigned expression compared with zero: pr -> num_zones < 0 Signed-off-by: Yang Li --- drivers/powercap/arm_scmi_powercap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c index 36f6dc211fbb..11018e63bb8b 100644 --- a/drivers/powercap/arm_scmi_powercap.c +++ b/drivers/powercap/arm_scmi_powercap.c @@ -29,7 +29,7 @@ struct scmi_powercap_zone { }; struct scmi_powercap_root { - unsigned int num_zones; + int num_zones; struct scmi_powercap_zone *spzones; struct list_head *registered_zones; };