Message ID | 20221125092601.3703-1-abelova@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3879395wrr; Fri, 25 Nov 2022 01:27:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bEs/nOWCZ40d0rxKzjGdlwJfgflcmiGI0Kz1+3FKw9vpFEPtNEfmb1fkF8kIRlXiRx7dT X-Received: by 2002:a62:868a:0:b0:56e:3a98:f02 with SMTP id x132-20020a62868a000000b0056e3a980f02mr25556290pfd.53.1669368465180; Fri, 25 Nov 2022 01:27:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669368465; cv=none; d=google.com; s=arc-20160816; b=iw/joEEjaexYqK9Nq/GWjtvf2BNpKW3wTS53ljVrL5SnQDEeeJTfp5yBUBt7pZxdLu hnlfRgjbmyphq1uwMk9HzgG1b6DsKJeKSDTsazz4NamOnqJPnL3bFa65FSdEpn9KjuR9 61r+qDNJr/3yjfSc0gbQzcwq9sWf3UBGS2jo0Hk0Qg0NjBLcQKEtx47hz7iK+dvS0w0V vbT0E+SBcb0dcSUhq2XghdpK9vfRLLFQNPETrW/6MbbQ3qdLkbDjzcPaj5ZkHtErUXlX L33QzQlX7oCQlIiwxBBPqBaLjORkI2O5Hh757hXxCT6r2mAF69B0jLj9PdB1+6L0NGuf wNvA== 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=btd5BCK74T3HCrkYFswHCg2SlYH1HJVpAZMxqiNwUIs=; b=EFal5VIO8dOMOcjaU20R+i+7TiCbILba5jVEM0X7aDtvVltpT+IaYoC9JBydD8oYoq aNrgYCzk5tVU/OAGCD/whiHkksnSVd0fXr3SXckD9rV4PS6n+TZGACwFxmBw7RsH70P+ xKyuud7CM0d3HO9U7pA0nYfXMdISITWlGR8aLTqkF/d0D+n0E5kK35gzifPolKV5+JKq OnxybPoVc3MxKuorUVkS8VFg7pH6SnJ3+KqeqvYU127tY2drqjQB0tIJYMFzdOXo5adF BeFDQDdLk65j8mLMqK4/UYQJJ5N6VOUQWPOrfyFjmPSVydFrSQWEAzSrwpYsdGPVvV82 QXrA== 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 f2-20020a17090274c200b0017ab01a9cb4si3117707plt.317.2022.11.25.01.27.32; Fri, 25 Nov 2022 01:27:45 -0800 (PST) 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 S229879AbiKYJ0p (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Fri, 25 Nov 2022 04:26:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbiKYJ0Y (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 25 Nov 2022 04:26:24 -0500 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA823AC27; Fri, 25 Nov 2022 01:26:12 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id F30D11864518; Fri, 25 Nov 2022 12:26:08 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xpKOhFxgqLgb; Fri, 25 Nov 2022 12:26:08 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 917281864545; Fri, 25 Nov 2022 12:26:08 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Im-HyczXp3ix; Fri, 25 Nov 2022 12:26:08 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.20]) by mail.astralinux.ru (Postfix) with ESMTPSA id DCECD1864435; Fri, 25 Nov 2022 12:26:07 +0300 (MSK) From: Anastasia Belova <abelova@astralinux.ru> To: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Anastasia Belova <abelova@astralinux.ru>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Randy Dunlap <rdunlap@infradead.org>, Florian Fainelli <f.fainelli@gmail.com>, Maxime Bizon <mbizon@freebox.fr>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] MIPS: BCM63xx: Add check for NULL for clk in clk_enable Date: Fri, 25 Nov 2022 12:26:01 +0300 Message-Id: <20221125092601.3703-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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?1750459707723777099?= X-GMAIL-MSGID: =?utf-8?q?1750459707723777099?= |
Series |
MIPS: BCM63xx: Add check for NULL for clk in clk_enable
|
|
Commit Message
Anastasia Belova
Nov. 25, 2022, 9:26 a.m. UTC
Check clk for NULL before calling clk_enable_unlocked where clk
is dereferenced. There is such check in other implementations
of clk_enable.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
arch/mips/bcm63xx/clk.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Fri, 25 Nov 2022 at 10:28, Anastasia Belova <abelova@astralinux.ru> wrote: > > Check clk for NULL before calling clk_enable_unlocked where clk > is dereferenced. There is such check in other implementations > of clk_enable. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> > --- > arch/mips/bcm63xx/clk.c | 3 +++ > 1 file changed, 3 insertions(+) Makes sense, especially since clk_disable() already has a NULL check (in case anybody else wonders). Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
On 25/11/22 10:26, Anastasia Belova wrote: > Check clk for NULL before calling clk_enable_unlocked where clk > is dereferenced. There is such check in other implementations > of clk_enable. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> > --- > arch/mips/bcm63xx/clk.c | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 11/25/2022 1:26 AM, Anastasia Belova wrote: > Check clk for NULL before calling clk_enable_unlocked where clk > is dereferenced. There is such check in other implementations > of clk_enable. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Hi Anastasia, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v6.1-rc7 next-20221130] [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/Anastasia-Belova/MIPS-BCM63xx-Add-check-for-NULL-for-clk-in-clk_enable/20221125-173305 patch link: https://lore.kernel.org/r/20221125092601.3703-1-abelova%40astralinux.ru patch subject: [PATCH] MIPS: BCM63xx: Add check for NULL for clk in clk_enable config: mips-buildonly-randconfig-r002-20221128 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install mips cross compiling tool for clang build # apt-get install binutils-mips-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/881e6b8fb4e5b8a496f5083d3cc6873a3df339b4 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Anastasia-Belova/MIPS-BCM63xx-Add-check-for-NULL-for-clk-in-clk_enable/20221125-173305 git checkout 881e6b8fb4e5b8a496f5083d3cc6873a3df339b4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/bcm63xx/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> arch/mips/bcm63xx/clk.c:365:3: error: non-void function 'clk_enable' should return a value [-Wreturn-type] return; ^ 1 error generated. vim +/clk_enable +365 arch/mips/bcm63xx/clk.c 357 358 359 /* 360 * Linux clock API implementation 361 */ 362 int clk_enable(struct clk *clk) 363 { 364 if (!clk) > 365 return; 366 367 mutex_lock(&clocks_mutex); 368 clk_enable_unlocked(clk); 369 mutex_unlock(&clocks_mutex); 370 return 0; 371 } 372
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index 6e6756e8fa0a..401140cf36d9 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c @@ -361,6 +361,9 @@ static struct clk clk_periph = { */ int clk_enable(struct clk *clk) { + if (!clk) + return; + mutex_lock(&clocks_mutex); clk_enable_unlocked(clk); mutex_unlock(&clocks_mutex);