Message ID | 20230808173611.3066-1-zeming@nfschina.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1172793vqr; Sun, 6 Aug 2023 18:43:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeieZi0heG63/ouPvdjpSe/uDKI1DziikNEuK9ZceOPQCyIaP3XjncAs8UxCO94ZkSnL4a X-Received: by 2002:a05:6a00:2d91:b0:687:2cba:67ad with SMTP id fb17-20020a056a002d9100b006872cba67admr7342991pfb.2.1691372632775; Sun, 06 Aug 2023 18:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691372632; cv=none; d=google.com; s=arc-20160816; b=RcVka/4f1xPtnFWNjaZIsZKNRKFDx0qFwLpoH9D+O33YJpApW9LcKQddrehDDsEIfB fzY4AYkK8uhDhZlaSakKNLw8nzkBXR0AODJgBdpVm7hRjBLC0fFt3HfeJ+FbxZe/Wp3Q 3NbMqvmkt28L4eHd6JxqWHHozlh8eeYinYMU+5JkQDv1oFxkS6ZbQrw+YBIzbifjh2Cf FEVGrMo8JVfKks6n3XVH3f0EGeuOXPMfclYd4DapUnnrMcyz/B6bvPvXltIhT5ymWgdd TpqjimL17Oo4n/qF57BSoaxd4wVHDNM+d+lFKC7UZHuGx9BL1aPYPUEEfAeRhRfvIVio UlsA== 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 :message-id:date:subject:cc:to:from; bh=SyN6/xtQgMTIFns6YBplmQpHoi9kbsPmbhxDLkXfee8=; fh=cdzbybEE8pI8liEkMwWU+G/cGRl1J9aiI6DhZnf1lZY=; b=Wr3Qa5yV4EAW5aUk737ccMQjkbBJnBqBcqiEum5rAjI0Smev9zrROo4afY6hC6nFLJ /HLh5b7Q77T2A7fOR/xZV5udpmmlkHc/X0MnkmZ06QDYORShyZmauWrhzb9fCXv8UcOg 6ElVyDIwljf5vBf3UrhzUBzptEx0+NTrGNUxRImjYGx4w96F9CxSqtmDywJmMFdZqi5j Dqqsv64ZFgBhAW/MI6yhdyE0v15aAZX5PESKYHPSkZJE/ixVM57JMC5qH/VZ5mHx/gi0 lzLNLMdJ8s+Jpv3IaKx617PfprE2GNQjFRoEOnx04CZBOBeD79w8LbG8ImS+6QhipY2k 3+jA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a056a00098f00b0066767d61b7esi5018124pfg.331.2023.08.06.18.43.36; Sun, 06 Aug 2023 18:43:52 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbjHGBE6 (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Sun, 6 Aug 2023 21:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjHGBE4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 6 Aug 2023 21:04:56 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 00BC3170A for <linux-kernel@vger.kernel.org>; Sun, 6 Aug 2023 18:04:55 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id DE994602AFEDE; Mon, 7 Aug 2023 09:04:52 +0800 (CST) X-MD-Sfrom: zeming@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li zeming <zeming@nfschina.com> To: jstultz@google.com, tglx@linutronix.de, sboyd@kernel.org Cc: linux-kernel@vger.kernel.org, Li zeming <zeming@nfschina.com> Subject: [PATCH] =?utf-8?q?kernel=3A_time=3A_clocksource=3A_Remove_unnecessa?= =?utf-8?q?ry_=E2=80=980=E2=80=99_values_from_ret?= Date: Wed, 9 Aug 2023 01:36:11 +0800 Message-Id: <20230808173611.3066-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_24_48, RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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: INBOX X-GMAIL-THRID: 1773532749627892021 X-GMAIL-MSGID: 1773532749627892021 |
Series |
kernel: time: clocksource: Remove unnecessary ‘0’ values from ret
|
|
Commit Message
Li zeming
Aug. 8, 2023, 5:36 p.m. UTC
ret is assigned first, so it does not need to initialize the assignment.
Signed-off-by: Li zeming <zeming@nfschina.com>
---
kernel/time/clocksource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Li,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/timers/core]
[also build test WARNING on linus/master v6.5-rc5 next-20230804]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Li-zeming/kernel-time-clocksource-Remove-unnecessary-0-values-from-ret/20230807-090629
base: tip/timers/core
patch link: https://lore.kernel.org/r/20230808173611.3066-1-zeming%40nfschina.com
patch subject: [PATCH] kernel: time: clocksource: Remove unnecessary ‘0’ values from ret
config: um-allnoconfig (https://download.01.org/0day-ci/archive/20230807/202308071105.lWPLR4Kr-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230807/202308071105.lWPLR4Kr-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308071105.lWPLR4Kr-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from kernel/time/clocksource.c:11:
In file included from include/linux/clocksource.h:22:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from kernel/time/clocksource.c:11:
In file included from include/linux/clocksource.h:22:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from kernel/time/clocksource.c:11:
In file included from include/linux/clocksource.h:22:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
692 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
700 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
708 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
717 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
726 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
735 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> kernel/time/clocksource.c:1295:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
1295 | if (!list_empty(&cs->list))
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/time/clocksource.c:1298:9: note: uninitialized use occurs here
1298 | return ret;
| ^~~
kernel/time/clocksource.c:1295:2: note: remove the 'if' if its condition is always true
1295 | if (!list_empty(&cs->list))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1296 | ret = clocksource_unbind(cs);
| ~~~~~~~~~~~~~~~~
kernel/time/clocksource.c:1292:9: note: initialize the variable 'ret' to silence this warning
1292 | int ret;
| ^
| = 0
13 warnings generated.
vim +1295 kernel/time/clocksource.c
7eaeb34305dee2 Thomas Gleixner 2013-04-25 1285
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1286 /**
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1287 * clocksource_unregister - remove a registered clocksource
b1b73d095084e7 Kusanagi Kouichi 2011-12-19 1288 * @cs: clocksource to be unregistered
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1289 */
a89c7edbe7d7aa Thomas Gleixner 2013-04-25 1290 int clocksource_unregister(struct clocksource *cs)
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1291 {
1c69718b036413 Li zeming 2023-08-09 1292 int ret;
a89c7edbe7d7aa Thomas Gleixner 2013-04-25 1293
75c5158f70c065 Martin Schwidefsky 2009-08-14 1294 mutex_lock(&clocksource_mutex);
a89c7edbe7d7aa Thomas Gleixner 2013-04-25 @1295 if (!list_empty(&cs->list))
a89c7edbe7d7aa Thomas Gleixner 2013-04-25 1296 ret = clocksource_unbind(cs);
75c5158f70c065 Martin Schwidefsky 2009-08-14 1297 mutex_unlock(&clocksource_mutex);
a89c7edbe7d7aa Thomas Gleixner 2013-04-25 1298 return ret;
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1299 }
fb63a0ebe615fb Martin Schwidefsky 2009-08-14 1300 EXPORT_SYMBOL(clocksource_unregister);
4713e22ce81eb8 Thomas Gleixner 2008-01-30 1301
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 91836b727cef..b4ad38812ef7 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -1289,7 +1289,7 @@ static int clocksource_unbind(struct clocksource *cs) */ int clocksource_unregister(struct clocksource *cs) { - int ret = 0; + int ret; mutex_lock(&clocksource_mutex); if (!list_empty(&cs->list))