Message ID | 20230614012913.122220-2-yang.lee@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp939457vqr; Tue, 13 Jun 2023 18:49:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4X49KgrBxCBFg9g4xUoMZJ/4VwwuLPP5VD7lW5uaAWfFyYBesbJGGszpbKSEA+ga1pMCIS X-Received: by 2002:a17:907:2d2c:b0:965:d18b:f03a with SMTP id gs44-20020a1709072d2c00b00965d18bf03amr15209965ejc.58.1686707346221; Tue, 13 Jun 2023 18:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686707346; cv=none; d=google.com; s=arc-20160816; b=BSuNPRRhJsHc4vp9kDAvjAivbrYBG2gI6xXTz8fkMgSn0cj95v218cWZQag9UmybVV J6RCepN2Meyk8VEg5rm1KsQTRwsGASESaAZsNNrex2/GS8IMG2qw/gXOT7L2Ofn/P+4U 8skVzT3J3lmBY1a0BDMaMh0znoE87mDXAsBhnCJbsZdg+XHkIMqz/aW5EaxVOZ+sZy1e 8b/UTwXwVB34lR+BFOkHmk5njKwnfJSE0zB0vs4W8ny6W3DfKm6YnES7XvjgOzJWiAdv OQ382rSD08y4rN3FQk2hcvWSFgneP7pXQrd5/JjiUQ+KgZWEPkBEUFeF+DxOVT74rxfS Hz/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Pn919uAu8BiyJ1Xs2rf5InzIq9cbXsTDYl0MyGhPcjE=; b=T6xlOcI8eS2zMLyibHtseaSMqAsgHVwDHzIWYmTZ2G4fo0vuR5F8a7XIPy7S/Xa8dc hglU8xkChQ79VbqGdBNHmgytgKE7z1nKCMNkJdNxavyDDsg623Tg8O2kKReOg7rwZpA3 iofiAdLGBwP4bmFqPeAo2hkhCAUvjE1YoOc4ggOTDioels2XK4MYTGn0r76AqQQSXhz+ sVHUjt6Ko/YBOay8Qgb5cPEF0oQpDoUztTNZBWp/SGYFffNJabmsyLkvJPkbjmqoUJQb uC2k3EJvbexcTSiWGeWBjP8PxdCTpbTkpe09d3a2Gh7VqzgyGndnpDmABUNdhG3OdV4V 46tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a170906814f00b0097397abcee3si7691925ejw.848.2023.06.13.18.48.42; Tue, 13 Jun 2023 18:49:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241271AbjFNB31 (ORCPT <rfc822;jesperjuhl76@gmail.com> + 99 others); Tue, 13 Jun 2023 21:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbjFNB3W (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 13 Jun 2023 21:29:22 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E82CE57; Tue, 13 Jun 2023 18:29:21 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0Vl4DoHI_1686706156; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Vl4DoHI_1686706156) by smtp.aliyun-inc.com; Wed, 14 Jun 2023 09:29:17 +0800 From: Yang Li <yang.lee@linux.alibaba.com> To: sboyd@kernel.org Cc: mturquette@baylibre.com, orsonzhai@gmail.com, baolin.wang@linux.alibaba.com, zhang.lyra@gmail.com, pdeschrijver@nvidia.com, pgaikwad@nvidia.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li <yang.lee@linux.alibaba.com>, Abaci Robot <abaci@linux.alibaba.com> Subject: [PATCH -next 2/3] clk: stm32: core: Fix unsigned comparison with less than zero Date: Wed, 14 Jun 2023 09:29:12 +0800 Message-Id: <20230614012913.122220-2-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c In-Reply-To: <20230614012913.122220-1-yang.lee@linux.alibaba.com> References: <20230614012913.122220-1-yang.lee@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768640842439103063?= X-GMAIL-MSGID: =?utf-8?q?1768640842439103063?= |
Series |
[-next,1/3] clk: sprd: composite: Fix unsigned comparison with less than zero
|
|
Commit Message
Yang Li
June 14, 2023, 1:29 a.m. UTC
The return value of the divider_ro_round_rate() is long.
However, the return value is being assigned to an unsigned
long variable 'rate', so making 'rate' to long.
silence the warnings:
./drivers/clk/stm32/clk-stm32-core.c:451:6-10: WARNING: Unsigned expression compared with zero: rate < 0
./drivers/clk/stm32/clk-stm32-core.c:461:5-9: WARNING: Unsigned expression compared with zero: rate < 0
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5519
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/clk/stm32/clk-stm32-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Quoting Yang Li (2023-06-13 18:29:12) > The return value of the divider_ro_round_rate() is long. > However, the return value is being assigned to an unsigned > long variable 'rate', so making 'rate' to long. > > silence the warnings: > ./drivers/clk/stm32/clk-stm32-core.c:451:6-10: WARNING: Unsigned expression compared with zero: rate < 0 > ./drivers/clk/stm32/clk-stm32-core.c:461:5-9: WARNING: Unsigned expression compared with zero: rate < 0 > > Reported-by: Abaci Robot <abaci@linux.alibaba.com> > Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5519 > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> > --- > drivers/clk/stm32/clk-stm32-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c > index d5aa09e9fce4..067b918a8894 100644 > --- a/drivers/clk/stm32/clk-stm32-core.c > +++ b/drivers/clk/stm32/clk-stm32-core.c > @@ -431,7 +431,7 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw, > { > struct clk_stm32_composite *composite = to_clk_stm32_composite(hw); > const struct stm32_div_cfg *divider; > - unsigned long rate; > + long rate; > Instead of this can you convert this code to use divider_ro_determine_rate() and divider_determine_rate()?
diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c index d5aa09e9fce4..067b918a8894 100644 --- a/drivers/clk/stm32/clk-stm32-core.c +++ b/drivers/clk/stm32/clk-stm32-core.c @@ -431,7 +431,7 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw, { struct clk_stm32_composite *composite = to_clk_stm32_composite(hw); const struct stm32_div_cfg *divider; - unsigned long rate; + long rate; if (composite->div_id == NO_STM32_DIV) return 0;