Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3474375rwb; Fri, 9 Dec 2022 15:15:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6k+6RMVQylN+FzyAHRvQmBM7AoDpeZUXz7+Vs2g1PlvrHsVC+7KbXg8AKIy+M6YzFUWqgG X-Received: by 2002:a17:90a:9742:b0:219:c2f2:f818 with SMTP id i2-20020a17090a974200b00219c2f2f818mr7627880pjw.42.1670627740154; Fri, 09 Dec 2022 15:15:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670627740; cv=none; d=google.com; s=arc-20160816; b=zoGI/VSzryLePPcQxU0bHSJlbLfKqrSN2ak/V4M1LqNEOcBIs7PyLKwwN5u2vJG0Ld Y0KP88FoPUKnnP9TwTFyIM/b2V0+qMml52BrKXX2/Yx75zmceRPsJsCqjLsnrEtkz0Nw lN9k5VKfM7tpLJCRj/+gHDpvx7wwPm7Q4qaoipY2gUPLOj+NGFiW9VFPFpN2wH5BGInX YqsnRB9LWnQZM7GS/N8/xZS0hqjZa3u0kgliKXBUu1yrRUU3FSF0nBY2xL37qWytvsOZ zf7p8MYeB+B70mijh0+MtPyW4PY0cm4XkCd0nbFwGUjYt7myhuTvAsHmC3jz+AADncwQ LVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=TDaVxVGkn8IH2E9ofy3ooQvEzmWEsX+rGwrjkMV7g9M=; b=pm3w8+YUbQErWYD/Sw+cVHCsU5GMa1sEjbMrRHZfwsJuKcrMuDyeTasg4ZuIPSk3ya Hic+Mr7/bu4V21jcCkg0lThEec6Wwc2ot7AJEw2iq+8xdZ0VBnKTqng3zrA9EsYV2wAD 2Tb9x1FsCRY+xjGv9Yc5aFyaIpHDPtodfKe6wPe4mldp8mdEt4H9O7CJGFuxmDsfpJ1z U9hGxHHhnL3dcDLgrP/O898ElqHrXvc70pONWFsnSxG5Pefz0P4zbcsmDA/2xOcB3+JX +5+woS7xd1+iqYfcyYAhUqglj2VPzjSb6RD7Qmu9eFau9L3VM7qhixWOp9OYHhjIH9Zl FimQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a6566d4000000b00473d2c2c082si2613609pgw.361.2022.12.09.15.15.29; Fri, 09 Dec 2022 15:15:39 -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 S229853AbiLIWmt (ORCPT + 75 others); Fri, 9 Dec 2022 17:42:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbiLIWmq (ORCPT ); Fri, 9 Dec 2022 17:42:46 -0500 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E7BD165B1; Fri, 9 Dec 2022 14:42:44 -0800 (PST) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1p3m4f-0005PX-00; Fri, 09 Dec 2022 23:42:33 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 56DCFC248E; Fri, 9 Dec 2022 23:41:40 +0100 (CET) Date: Fri, 9 Dec 2022 23:41:40 +0100 From: Thomas Bogendoerfer To: Anastasia Belova Cc: Randy Dunlap , Florian Fainelli , Jonathan Cameron , Ralf Baechle , Maxime Bizon , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH v3] MIPS: BCM63xx: Add check for NULL for clk in clk_enable Message-ID: <20221209224140.GA4928@alpha.franken.de> References: <20221209100550.30470-1-abelova@astralinux.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221209100550.30470-1-abelova@astralinux.ru> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 09, 2022 at 01:05:50PM +0300, 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 > --- > v2: Fix errors reported by kernel test robot . > v3: Merge several patches into single one. > arch/mips/bcm63xx/clk.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c > index 6e6756e8fa0a..86a6e2590866 100644 > --- a/arch/mips/bcm63xx/clk.c > +++ b/arch/mips/bcm63xx/clk.c > @@ -361,6 +361,8 @@ static struct clk clk_periph = { > */ > int clk_enable(struct clk *clk) > { > + if (!clk) > + return 0; > mutex_lock(&clocks_mutex); > clk_enable_unlocked(clk); > mutex_unlock(&clocks_mutex); > -- > 2.30.2 applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]